Question: 6. (8 points) Write a query to retrieve the recording ID and recording date of all recordings that appear on every CD. Write the query

6. (8 points) Write a query to retrieve the recording ID and recording date of all recordings that appear on every CD. Write the query using the EXISTS keyword. 7. (7 points) Write a query that produces the same output as the previous question, but this time do not use the EXISTS keyword.

Using these tables

create table person (psnid int, psnfname varchar(30), psnlname varchar(30), primary key (psnid));

create table composition (compid int, comptitle varchar(30), compyear int, primary key (compid));

create table recording (rcdid int, rcdlength float, rcddate varchar(30), compid int,

primary key (rcdid, compid), foreign key (compid) references composition(compid));

create table person_composition (psncomprole varchar(30), psncomporder int, psnid int, compid int,

primary key (psncomprole, psnid, compid), foreign key (psnid) references person(psnid), foreign key (compid) references composition(compid));

create table person_recording (psnrcdrole varchar(30), psnid int, compid int, rcdid int, primary key (psnrcdrole, psnid, rcdid, compid),

foreign key (psnid) references person(psnid), foreign key (rcdid, compid) references recording(rcdid, compid));

create table label (lbltitle varchar(30), lblstreet varchar(30), lblcity varchar(30), lblstate varchar(30), lblpostcode varchar(30),

lblnation varchar(30), primary key (lbltitle));

create table cd (cdid int, cdlblid varchar(30), cdtitle varchar(30), cdyear int, lbltitle varchar(30), primary key (cdid),

foreign key (lbltitle) references label(lbltitle));

create table person_cd (psncdorder int, psnid int, cdid int, primary key (psnid, cdid), foreign key (cdid) references cd(cdid),

foreign key (psnid) references person(psnid));

create table track (cdid int, trknum int, rcdid int, compid int, primary key (trknum, cdid), foreign key (rcdid, compid) references recording(rcdid, compid),

foreign key (cdid) references cd(cdid));

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!