3.26

Using the university schema, use SQL to do the following: For each student who has retaken a course at least twice (i.e., the student has taken the course at least three times), show the course ID and the student’s ID. Please display your results in order of course ID and do not display duplicate rows.


SELECT id,course_id 
FROM takes
GROUP BY id,course_id
HAVING COUNT(*) >= 3
ORDER BY course_id ASC;