Programming Homework Help
Programming Homework Help. Lab 6: Subqueries
Need help with below questions asap.
— Lab 6: Subqueries
— For all queries in this lab, the SQL query should contain a subquery unless specified otherwise.
— Use the Chinook database , Application my SQLWorkbench
— 1. Write a select statement that uses a subquery that is equivalent to this Join query:
— SELECT t.name, t.unitprice
— FROM track t JOIN playlisttrack pl using(trackId)
— WHERE playlistId = 16;
— 2. Write a select statement that uses a subquery to display the track name and composer for all tracks that are on an album with the artistID = 22;
— 3. Write a select statement that uses a subquery to display the name from the track table of any tracks that do not have any sales (i.e. are not in the invoiceline table)
— 4. Write a select statement that uses a subquery to display the name and unitprice of all tracks that have a unitprice greater than the average track unitprice.
— 5. Write a select statement that uses a subquery to display the name of any track that is longer (milliseconds) than the average milliseconds for tracks with albumId=253
— 6. Write a select statement that uses a subquery to display the name and unitprice of all tracks that have a unitprice higher than any track in genreid 4
— 7. Use the EXISTS operator to display the name and unitprice of all tracks that have a row in the invoiceline table.
— 8. Use a subquery in the FROM clause to display the artistId and length in minutes (milliseconds/60 rounded to 2 decmal places) of the longest album for each artistId. (Hint: the subquery should select the artistid, albumid and sum the milliseconds for all the tracks grouped by albumid.)
— 9. Use a correlated subquery to display the trackid, name, and milliseconds/60000 rounded to 2 decimal places for the longest track on an album.