Artists info (chinook database)
In this lab, you will be presented with a series of challenges that test your SQL querying skills using the SQLite-supported chinook database schema.
Dataset Overview
The chinook database contains a rich set of tables that capture information about artists, albums, tracks, genres, playlists, invoices, and more. The schema of some critical tables is as follows:
-
Artist
"ArtistId"
: The primary key."Name"
: Artist's name.
-
Album
"AlbumId"
: The primary key."Title"
: Album title."ArtistId"
: Foreign key to theArtist
table.
-
Track
- Various columns including
"Name"
for the track name and"AlbumId"
for foreign key relation to theAlbum
table.
- Various columns including
Instructions
-
You will be provided with a set of challenges. Each challenge will require you to write SQL queries to extract, transform, or analyze the data in the chinook database.
-
Ensure you use double quotes around table and column names for clarity and to avoid potential issues with reserved words or special characters.
-
Given the diverse nature of the data in the database, it's essential to order your results to ensure consistent outputs. When crafting your solutions, always use an
ORDER BY
clause unless instructed otherwise. -
Pay close attention to the exact column names mentioned in each challenge. Your solutions should match these column names exactly, as they will be used for evaluation purposes. For instance, in one of the challenges, you'll be retrieving artist names and album titles. Your output columns should be named
"ArtistName"
and"AlbumTitle"
, exactly as defined in the solution. -
Ensure you understand the relationships between tables, especially where foreign keys are involved. Use the correct type of JOIN operation based on the requirements of each challenge.
Evaluation
Your solutions will be automatically evaluated against a set of expected outputs. Make sure you thoroughly test your queries to ensure they meet the requirements of each challenge. Any deviation from the expected column names, ordering, or output will result in the challenge being marked as incomplete.
Happy querying, and good luck!
Challenges Information
Challenge 1: Artist Names and Album Titles
Objective: Your task is to extract a list showcasing the artist names along with their respective album titles.
Tables Involved:
Artist
Album
Instructions:
-
Columns to Retrieve:
Artist.Name
: This represents the name of the artist.Album.Title
: This denotes the title of the album.
-
Ordering:
- The resulting data should be ordered by the artist's name (
Artist.Name
).
- The resulting data should be ordered by the artist's name (
-
Joining Tables:
- You need to join the
Artist
andAlbum
tables using theArtistId
. Your SQL query should utilize the JOIN operation based on this relationship.
- You need to join the
Hint:
- Your resulting dataset should have columns named
ArtistName
andAlbumTitle
- Remember to use double quotes around table and column names for clarity.