SQL Write a query to identify the single track that has no c

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

Solution

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\');

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site