본문 바로가기
SQL

leetcode 1280. Students and Examinations

by 무적김두칠 2023. 4. 12.

https://leetcode.com/problems/students-and-examinations/description/

 

Students and Examinations - LeetCode

Can you solve this real interview question? Students and Examinations - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

1
2
3
4
5
6
7
8
9
10
11
12
# Write your MySQL query statement below
 
select 
s.student_id,
s.student_name, sub.subject_name,
count(e.subject_name) attended_exams 
from Students s
join Subjects sub
left join Examinations e
on s.student_id = e.student_id and e.subject_name =sub.subject_name 
group by s.student_id, sub.subject_name
order by s.student_id, sub.subject_name
cs
반응형

댓글