Give the most recently attended course.
select course_id from student_course_attendance order by date_of_attendance desc limit 1
What about for the course 301?
select course_id from student_course_attendance where course_id = 301 order by date_of_attendance desc limit 1
Give the student id instead.
select student_id from student_course_attendance where course_id = 301 order by date_of_attendance desc limit 1