3.29
Using the university schema, write an SQL query to find the name and ID of each History student whose name begins with the letter āDā and who has not taken at least five Music courses.
SELECT id,name
FROM student AS s
WHERE dept_name = 'History'
AND name LIKE 'D%'
AND (
SELECT COUNT(DISTINCT course_id)
FROM takes
WHERE takes.id = s.id AND
IN (SELECT course_id FROM course WHERE dept_name = 'Music')
course_id < 5; )