Executing stored procedure prints only the last record
Solution 1:
Normally you would just return a resultset, and the calling program would display the data. So
create or alter procedure DISPLAY3 @semester int
as
begin
select StdName, HMarks = Max(sm.MarksObtained), LMarks = Min(sm.MarksObtained)
from std s
inner join stdcourseteacher sct on sct.StdID = s.StdID
inner join Exam e on e.SemID = @semester and e.Topic = 'Final-Term'
inner join StdMarks sm on sm.StdID = sct.StdID and e.ExamID = sm.ExamID
group by s.StdName
end