Counting Tracks in Each Album
Easy
4
81.8% Acceptance
Welcome to this SQL lab where you will be honing your SQL skills using the Chinook database. The lab is designed to challenge your understanding of SQL queries, particularly in SQLite.
How To Use This Lab
- You'll find SQL challenges listed.
- Read each problem statement carefully.
- Write your SQL query in the editor provided.
- Once you run the query, your output will be compared to the expected output.
Database Schema
The Chinook database contains various tables, but for the purpose of these challenges, you will mainly use the "Track" table.
Track
- "TrackId" (Primary Key)
- "Name"
- "AlbumId" (Foreign Key to Album)
- "MediaTypeId" (Foreign Key to MediaType)
- "GenreId" (Foreign Key to Genre)
- "Composer"
- "Milliseconds"
- "Bytes"
- "UnitPrice"
Challenge
- Table Used:
Track
- Task: Count the number of tracks in each album. Use the columns
AlbumId
andTrackId
from theTrack
table. - Final Columns to Display:
AlbumId
,TrackCount
- Column Aliasing: Use the alias
TrackCount
for the count of tracks. - Ordering: Order the results by
AlbumId
in ascending order.