Sorting and Limiting Results
Easy
4
87.5% Acceptance
Welcome to this SQL lab where you will be introduced to two fundamental SQL clauses: ORDER BY
and LIMIT
. Using the well-known Chinook database, you will practice sorting query results and limiting the number of records returned.
The primary objective of this lab is to provide hands-on experience with the ORDER BY
and LIMIT
clauses in SQL. You will be working exclusively with the Chinook database, focusing on the "Track" table.
Schema
Here's the schema for the Track
Table for reference
TrackId
Name
AlbumId
MediaTypeId
GenreId
Composer
Milliseconds
Bytes
UnitPrice
Challenge
Write a SQL query to identify and list the top 5 most expensive tracks available in the Track
table. Your query should focus exclusively on the Name
and UnitPrice
columns. The output must be sorted by UnitPrice
in descending order, limited to just the top 5 records.
Example Output
"Name" | "UnitPrice" |
---|---|
TrackName1 | 1.99 |
TrackName2 | 1.98 |
TrackName3 | 1.97 |
TrackName4 | 1.96 |
TrackName5 | 1.95 |