Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Identify and explain the six qualitative characteristics of GAAP.

Answered: 1 week ago

Question

What do you think you will bring to the organization?

Answered: 1 week ago