[문제]
[MySQL]
SELECT s.student_id
, s.student_name
, sub.subject_name
, COUNT(e.student_id) AS attended_exams
FROM Students AS s
CROSS JOIN Subjects AS sub
LEFT JOIN Examinations AS e ON s.student_id = e.student_id
AND sub.subject_name = e.subject_name
GROUP BY s.student_id, sub.subject_name
ORDER BY s.student_id, sub.subject_name
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 1327. List the Products Ordered in a Period (0) | 2025.02.20 |
|---|---|
| [LeetCode] 1321. Restaurant Growth (0) | 2025.02.20 |
| [LeetCode] 1251. Average Selling Price (0) | 2025.02.20 |
| [LeetCode] 1211. Queries Quality and Percentage (0) | 2025.02.19 |
| [LeetCode] 1204. Last Person to Fit in the Bus (0) | 2025.02.19 |
