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

SQL Write a query to identify the single track that has no composer and is on bo

ID: 3797514 • Letter: S

Question

SQL

Write a query to identify the single track that has no composer and is on both the "Grunge" and the "90's Music" playlists. Your query must not hardcode any numeric ids (e.g. GenreID, TrackID, AlbumID, ArtistID, PlaylistID). The result set (see figure below) should have a single row with the following columns (in order): track name (track_name), album title (album_title), album artist's name (artist_name), and genre name (genre_name). Your query must have subquery for full points

Album Artist Albumld Artistld Title Name L Artist ld PlaylistTrack Playlist playlistId stid Trackld Name Employee n Employ eeld e-m Customer Last Name CustomerId First Name FirstName Title LastName ReportsTo Com BirthDate Address HireDate City Address State City Country State PostalCode Country Phone PostalCode Fax Phone Email Fax Email supportRepld Track Trackld Name Albumld MediaTypeld Genreld Composer Milliseconds Bytes Unit Price Invoice Line Invoice Lineld nvoiceld Trackld UnitPrice Quantity Invoice Invoice Id L customer ld Invoice Date Billing Address BillingCity Billingstate BillingCountry Billing PostalCode Total Media Type Media T Name Genre Genreld Name

Explanation / Answer

Select T.Name,Al.Title,Ar.Name,G.Name from Track T inner join Album AL on T.AlbumId = Al.AlbumId inner join Artist Ar on Al.ArtistId = Ar.ArtistId inner join Genre G on T.GenreId = G.GenreId inner join PlaylistTrack PT on T.TrackId = PT.TrackId inner join Playlist P on P.playlistId = PT.PlaylistId where T.composer IS NULL and P.Name = (Select name from Playlist where name = 'Grunge' and Name = '90's Music');