Find the genre which has at most 1 track. Print the name of such genre. Number o
ID: 3872566 • Letter: F
Question
Find the genre which has at most 1 track. Print the name of such genre. Number of rows returned in the result = 1
A) Find the tracks that were purchased in California (CA) or Washington (WA). Print the name of such tracks. Number of rows returned in the result = 151
B) Find the tracks that have been purchased in quantities greater than 5. Print the name of such tracks. Number of rows returned in the result = 0
C) Find the tracks which cost less than a dollar but the track length (Milliseconds) is more than the average track length in this database. Print the name of such tracks. Number of rows returned in the result = 282
TEE Track Trackld T Album Artist Artistld Name MediaType MediaTypeld Name Tite Artistld Albumld MediaTypeld Genreld Composer Milliseconds Genre Genreld Name Playlist Playlistd Name PlaylistTrack Playlistic Trackld Bytes UnitPrice Employee Employeeld LastName FirstName InvoiceLine InvoiceLineld Invoiceld Trackld UnitPrice Quantity Customer Customerld FirstName LastName Company Address ReportsTo BirthDate HireDate Address City State Country PostalCode Phone Fax Email Invoice Invoiceld Customerld InvoiceDate illingAddress BillingCity BillingState BillingCountry State Country PostalCode Fax SupportRepld TotalExplanation / Answer
Hi,
Ans 1 -
select trackid,count(genreid) from Track group by trackid having count(genreid)=1;
Ans A - select T.name as TrackName from InvoiceLine IL join
Invoice I
on IL.invoiceid=I.Invoiceid
and I.BillingCity in('CA','WA')
join Track T
on IL.TrackId=T.TrackID;
Ans B-
select T.name from InvoiceLine IL
join Track T
on IL.TrackId=T.TrackId
and IL.Quantity>5;
Ans C-
select name from Track T where UnitPrice<1 and miliseconds >(select avg(milliseconds) from Track where TrackId=T.TrackId)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.