How many students are there?
select count ( distinct student_id ) from courses as t1 join student_course_attendance as t2 on t1.course_id = t2.course_id
And the amount of courses?
select count ( distinct t1.course_id ) from courses as t1 join student_course_attendance as t2 on t1.course_id = t2.course_id
And how many courses did student 171 take?
select count ( * ) from courses as t1 join student_course_attendance as t2 on t1.course_id = t2.course_id where t2.student_id = 171