3.33

Using the university schema, write an SQL query to find the ID and title of each course in Comp. Sci. that has had at least one section with afternoon hours (i.e., ends at or after 12:00). (You should eliminate duplicates if any.)


SELECT course_id,title
FROM course AS c
WHERE dept_name = 'Comp. Sci.' AND 
    EXISTS (
        SELECT * 
        FROM section
        WHERE section.course_id = c.course_id AND 
        time_slot_id IN (SELECT time_slot_id FROM time_slot WHERE end_hr >= 12)
    )