Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

albums Saturday Night Fever and 2 1 . 2 . Modify the GROUP BY clause to select albums with three or more songs by the

albums Saturday Night Fever and 21.
2. Modify the GROUP BY clause to select albums with three or more songs by the same artist. Run the query and verify the result table shows just the album 21.
(1, 'Saturday Night Fever', 1977),
(2, 'Born in the U.S.A.',1984),
(3, 'Supernatural', 1999),
(4,'21',2011);
CREATE TABLE Song (
ID INT,
Title VARCHAR(60),
Artist VARCHAR(60),
AlbumID INT,
PRIMARY KEY (ID),
FOREIGN KEY (AlbumID) REFERENCES Album(ID)
;
INSERT INTO SONG VALUES
(100, 'Stayin' Alive', 'Bee Gees', 1),
(101, 'More Than a Woman', 'Bee Gees', 1),
(102,'If I Can't Have You', 'Yvonne Elliman', 1),
(200, 'Dancing in the Dark', 'Bruce Springsteen', 2),
(201, 'Glory Days', 'Bruce Springsteen', 2),
(300, 'Smooth', 'Santana', 3),
(400, 'Rolling in the Deep', 'Adele', 4),
(401, 'Someone Like You', 'Adele', 4),
(402, 'Set Fire to the Rain', 'Adele', 4),
(403, 'Rumor Has It', 'Adele', 4);
SELECT *
FROM Album
WHERE EXISTS
(SELECT COUNT(*)
FROM SONg
WHERE AlbumID = Album. ID
GROUP BY AlbumID
HAVING COUNT (**)3);
image text in transcribed

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions