Problem: 1280. 學生們參加各科測試的次數
👨?🏫 參考題解
join
等價于inner join
,不用關聯條件的join
等價于cross join
Code
select stu.student_id,stu.student_name, sub.subject_name,count(e.subject_name) attended_exams
from Students stu
join Subjects sub
left join Examinations e
on e.student_id = stu.student_id
And e.subject_name = sub.subject_name
group bystu.student_id, sub.subject_name
order bystu.student_id,sub.subject_name