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

Please Provide an answer in MYSQL workbench List the top 5 artists in terms of t

ID: 3723073 • Letter: P

Question

Please Provide an answer in MYSQL workbench

List the top 5 artists in terms of total sales. List the artist Name, and the sum of all invoices by the artist, biggest (in terms of total sales, to smallest).

Hint : to do this you will need to join artist to album to track to invoiceline to invoice, sum the Total of each invoice, group by the artist name or artistid and sort the list in descending order with a limit clause.

Artist table:

Columns:

album table:

Table: album

Columns:

track table:

invoiceLine table:

invoice table:

ArtistId   int(11) AI PK Name

Explanation / Answer

select Artist.name, sum(invoice.Total) as Total
from Artist, album,track,invoiceLine,invoice where
Artist.ArtistId = album.ArtistId,
album.AlbumId = track.AlbumId,
track.trackId = invoice.trackId,
invoiceLine.InvoiceId = invoice.InvoiceId
group by (Artist.ArtistId) order by Total desc Limit 5;