Joining Tables to Fetch Album Titles
You'll be working with the famous Chinook database, focusing on SQLite. The objective of this lab is to put your SQL skills to the test with practical exercises based on real-world-like data.
Dataset Overview
The Chinook dataset contains a rich set of tables that model a digital media store. Here's a quick overview of the tables you'll be working with:
Artist
: Contains information about artists.Album
: Contains album titles along with associated artists.Track
: Contains information about songs or tracks.
Instructions
-
Environment Setup: You don't need to worry about setting anything up! Everything is already in place for you to just dive in and start coding.
-
Query File: All your SQL queries should be written and saved in the provided
query.sql
file. -
Column Naming: When crafting your SQL statements, ensure that your resulting columns match the expected names exactly. For instance, if you're asked to produce a column named
"AlbumTitle"
, it should be labeled exactly that way in your query.
Challenge : Track-Album Association
Objective: Join the Track
and Album
tables to display the relationship between track names and their respective album titles.
Tables Used:
Track
Album
Task Details:
-
Joining: You are required to perform an inner join between the
Track
andAlbum
tables. -
Columns to Display:
TrackId
from theTrack
table.Name
from theTrack
table. This should be labeled asTrackName
.Title
from theAlbum
table. This should be labeled asAlbumTitle
.
-
Ordering: The resulting dataset should be ordered by
TrackId
.
Expected Outcome:
On successful execution, your query should produce a list of tracks, displaying their TrackId
, TrackName
, and the AlbumTitle
they belong to, ordered by TrackId
.
Evaluation
Once you've written your solution in the query.sql
file, it will be evaluated against a set solution to determine if you've passed the challenge. Ensure that your solutions match the given problem statements precisely, paying special attention to the "ORDER BY"
clauses as they are crucial for matching outputs.
Best of luck, and happy querying!