Can you tell me the id of the students who registered for course 301?
select student_id from student_course_attendance where course_id = 301
Which one of them registered the earliest?
select student_id from student_course_attendance where course_id = 301 order by date_of_attendance limit 1
Which one registered most recently for that course?
select student_id from student_course_attendance where course_id = 301 order by date_of_attendance desc limit 1