https://www.youtube.com/watch?v=dgIYeUAOzbM&list=PLavw5C92dz9Hxz0YhttDniNgKejQlPoAn&index=6

drop table if exists  student_tests;
create table student_tests
(
	test_id		int,
	marks		int
);
insert into student_tests values(100, 55);
insert into student_tests values(101, 55);
insert into student_tests values(102, 60);
insert into student_tests values(103, 58);
insert into student_tests values(104, 40);
insert into student_tests values(105, 50);

select * from student_tests;

Pasted image 20241117205317.png
SUBQUERY

-- Including the 1st test score.
SELECT test_id,marks
FROM (select *,LAG(marks,1,0) OVER(ORDER BY test_id) AS prev_marks, 
from student_tests) x
WHERE x.marks > x.prev_marks
-- Excluding 1st test score.
SELECT test_id,marks
FROM (select *,LAG(marks,1,marks) OVER(ORDER BY test_id) AS prev_marks, 
from student_tests) x
WHERE x.marks > x.prev_marks