Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following 5 relations of a database: Songs (title, year, length, ge

ID: 3871844 • Letter: C

Question

Consider the following 5 relations of a database:

Songs (title, year, length, genre, studioName, producerC#)

Singers (songTitle, songYear, singerName )

SongSinger (name, address, gender, birthdate)

SongExec (name, cert#, address, networth)Studio (name, address, presC#)

Find the SQL queries for:

1. Find the names of singers who sing in only songs produced by "Sony" studios

2. Find the studio names and names of studio presidents of the studios that have "Justin Bieber" singing in every song the studio produces.

3. Find the names of studio presidents whose networth is more than the average networth of all studio presidents

Explanation / Answer

1) select name from Singers where songTitle in (select title from Songs where studioName = 'Sony')

2) select st.name,st.presC# from Studio st where st.name in (select s.studioname from Songs s group by s.studioName having count(s.title) ==(select count(stemp.title) from Songs stemp,Singers sstemp where s.studioname=stemp.studioname AND stemp.title=sstemp.songTitle AND sstemp.singerName='JustinBieber' group by stemp.studioname))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote