Sorting and Limiting Results

Easy
4
88.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"
TrackName11.99
TrackName21.98
TrackName31.97
TrackName41.96
TrackName51.95