← All schemas
Schema Library

Chinook Database Schema Diagram

Chinook is a digital music store sample database: artists release albums, albums contain tracks, tracks have a genre and a media type, customers buy tracks through invoices and invoice lines, and tracks are grouped into playlists. All eleven tables and their foreign keys are mapped in the diagram above. Two details worth knowing: playlist_track is a composite-key join table with no surrogate id, and track.album_id and track.genre_id are nullable - a track can exist without an album (singles) or a genre, while media_type_id is always required.

Last updated: 2026-09-27

Source: Chinook database, Chinook_PostgreSql.sql v1.4.5 (lerocha/chinook-database) · License: MIT

Tables
11
Core table
track
Sample data
15,000+ rows
Mini Map
Open in DBdiagramr to edit →

Tables in the Chinook schema

ColumnTypeNullableKey
album
album_idINTNoPK
titleVARCHAR(160)No-
artist_idINTNo-
artist
artist_idINTNoPK
nameVARCHAR(120)Yes-
customer
customer_idINTNoPK
first_nameVARCHAR(40)No-
last_nameVARCHAR(20)No-
companyVARCHAR(80)Yes-
addressVARCHAR(70)Yes-
cityVARCHAR(40)Yes-
stateVARCHAR(40)Yes-
countryVARCHAR(40)Yes-
postal_codeVARCHAR(10)Yes-
phoneVARCHAR(24)Yes-
faxVARCHAR(24)Yes-
emailVARCHAR(60)No-
support_rep_idINTYes-
employee
employee_idINTNoPK
last_nameVARCHAR(20)No-
first_nameVARCHAR(20)No-
titleVARCHAR(30)Yes-
reports_toINTYes-
birth_dateTIMESTAMPYes-
hire_dateTIMESTAMPYes-
addressVARCHAR(70)Yes-
cityVARCHAR(40)Yes-
stateVARCHAR(40)Yes-
countryVARCHAR(40)Yes-
postal_codeVARCHAR(10)Yes-
phoneVARCHAR(24)Yes-
faxVARCHAR(24)Yes-
emailVARCHAR(60)Yes-
genre
genre_idINTNoPK
nameVARCHAR(120)Yes-
invoice
invoice_idINTNoPK
customer_idINTNo-
invoice_dateTIMESTAMPNo-
billing_addressVARCHAR(70)Yes-
billing_cityVARCHAR(40)Yes-
billing_stateVARCHAR(40)Yes-
billing_countryVARCHAR(40)Yes-
billing_postal_codeVARCHAR(10)Yes-
totalNUMERIC(10,2)No-
invoice_line
invoice_line_idINTNoPK
invoice_idINTNo-
track_idINTNo-
unit_priceNUMERIC(10,2)No-
quantityINTNo-
media_type
media_type_idINTNoPK
nameVARCHAR(120)Yes-
playlist
playlist_idINTNoPK
nameVARCHAR(120)Yes-
playlist_track
playlist_idINTNoPK
track_idINTNoPK
track
track_idINTNoPK
nameVARCHAR(200)No-
album_idINTYes-
media_type_idINTNo-
genre_idINTYes-
composerVARCHAR(220)Yes-
millisecondsINTNo-
bytesINTYes-
unit_priceNUMERIC(10,2)No-

Frequently asked questions

What tables are in the Chinook database?

Chinook has 11 tables: artist, album, track, genre, media_type, playlist, playlist_track, customer, employee, invoice, and invoice_line - covering a digital music store from catalog to checkout.

How do tracks relate to albums and playlists in Chinook?

A track optionally belongs to one album via track.album_id. Playlists link to tracks through the playlist_track join table, which has a composite primary key of (playlist_id, track_id) - a many-to-many relationship with no surrogate key.

Where can I download the Chinook PostgreSQL script?

From the official chinook-database repository on GitHub (Chinook_PostgreSql.sql, version 1.4+). It creates the schema and loads over 15,000 rows of sample data with a single script.

Explore more schemas

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →