Finding Tracks with Maximum and Minimum Length
Easy
4
57.7% Acceptance
Welcome to the SQLite lab, where you'll be testing your SQL skills using the widely known chinook database. The challenges in this lab focus on retrieving specific data sets from this database.
Dataset Overview
The chinook database consists of various tables related to a digital media store. For the scope of this lab, you will be working with the following tables:
Artist
: Contains artist details with columns "ArtistId" and "Name".Album
: Contains album details and references "Artist" with columns "AlbumId", "Title", and "ArtistId".Track
: Holds track details and references "Album", "MediaType", and "Genre" with columns like "TrackId", "Name", "Milliseconds", and more.
Instructions
- Craft your SQL queries based on the instructions provided in the challenge.
- Make sure to use double quotes around table and column names for clarity.
- Cross-check your query column names with the expected output column names.
- Once you believe your solution is correct, submit it for evaluation.
Remember, precision is key. Ensure that your queries match the requirements exactly to successfully pass the challenges.
Challenges
Objective: Identify tracks that have the longest and shortest durations in the chinook database.
Table Used: Track
Steps:
- Using the
Track
table, retrieve details of tracks that have the longest and shortest lengths. - You must extract the following columns for your results:
TrackId
Name
Milliseconds
- Your query should retrieve and compare results using the following conditions:
- The
Milliseconds
value should be equal to the minimumMilliseconds
from theTrack
table. - Or, the
Milliseconds
value should be equal to the maximumMilliseconds
from theTrack
table.
- The
- Sort your results based on the
Milliseconds
column, in ascending order. The track with the shortest length should appear first, followed by the one with the longest length.
Expected Output Columns:
TrackId
Name
Milliseconds
Order By:
Milliseconds (Ascending)
Good luck, and happy querying!