Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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:
ArtistId | int(11) AI PK |
Name |
album table:
Table: album Columns:
AlbumId | int(11) AI PK |
Title | varchar(160) |
ArtistId | int(11) |
track table:
TrackId | int(11) AI PK |
Name | varchar(200) |
AlbumId | int(11) |
MediaTypeId | int(11) |
GenreId | int(11) |
Composer | varchar(220) |
Milliseconds | int(11) |
Bytes | int(11) |
UnitPrice | decimal(10,2) |
invoiceLine table:
InvoiceLineId | int(11) AI PK |
InvoiceId | int(11) |
TrackId | int(11) |
UnitPrice | decimal(10,2) |
Quantity | int(11) |
invoice table:
InvoiceId | int(11) AI PK |
CustomerId | int(11) |
InvoiceDate | datetime |
BillingAddress | varchar(70) |
BillingCity | varchar(40) |
BillingState | varchar(40) |
BillingCountry | varchar(40) |
BillingPostalCode | varchar(10) |
Total | decimal(10,2) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started