Question: Using the WHERE and HAVING clauses, filter the track table for the tracks having the genre _ id set to 1 or 2 , grouped

Using the WHERE and HAVING clauses, filter the track table for the tracks having the genre_id set to 1 or 2, grouped by the album_id with a number of tracks greater than 15. Provide the list of album_id's and the sum of unit_price that fit these criteria.
Which of the following queries would provide the correct results?
SELECT album_id, sum(unit_price)
FROM track
WHERE genre_id in (1,2)
GROUP BY album_id
HAVING count(track_id)>15
SELECT album_id, sum(unit_price)
FROM track
WHERE count(track_id)>15
GROUP BY album_id
HAVING genre_id in (1,2)
SELECT album_id, sum(unit_price)
FROM track
HAVING count(track_id)>15
WHERE genre_id in (1,2)
GROUP BY album_id
SELECT album_id, count(unit_price)
FROM track
WHERE genre_id in (1,2)
GROUP BY album_id
HAVING sum(track_id)>15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!