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 in the Chinook schema
| Column | Type | Nullable | Key |
|---|---|---|---|
| album | |||
| album_id | INT | No | PK |
| title | VARCHAR(160) | No | - |
| artist_id | INT | No | - |
| artist | |||
| artist_id | INT | No | PK |
| name | VARCHAR(120) | Yes | - |
| customer | |||
| customer_id | INT | No | PK |
| first_name | VARCHAR(40) | No | - |
| last_name | VARCHAR(20) | No | - |
| company | VARCHAR(80) | Yes | - |
| address | VARCHAR(70) | Yes | - |
| city | VARCHAR(40) | Yes | - |
| state | VARCHAR(40) | Yes | - |
| country | VARCHAR(40) | Yes | - |
| postal_code | VARCHAR(10) | Yes | - |
| phone | VARCHAR(24) | Yes | - |
| fax | VARCHAR(24) | Yes | - |
| VARCHAR(60) | No | - | |
| support_rep_id | INT | Yes | - |
| employee | |||
| employee_id | INT | No | PK |
| last_name | VARCHAR(20) | No | - |
| first_name | VARCHAR(20) | No | - |
| title | VARCHAR(30) | Yes | - |
| reports_to | INT | Yes | - |
| birth_date | TIMESTAMP | Yes | - |
| hire_date | TIMESTAMP | Yes | - |
| address | VARCHAR(70) | Yes | - |
| city | VARCHAR(40) | Yes | - |
| state | VARCHAR(40) | Yes | - |
| country | VARCHAR(40) | Yes | - |
| postal_code | VARCHAR(10) | Yes | - |
| phone | VARCHAR(24) | Yes | - |
| fax | VARCHAR(24) | Yes | - |
| VARCHAR(60) | Yes | - | |
| genre | |||
| genre_id | INT | No | PK |
| name | VARCHAR(120) | Yes | - |
| invoice | |||
| invoice_id | INT | No | PK |
| customer_id | INT | No | - |
| invoice_date | TIMESTAMP | No | - |
| billing_address | VARCHAR(70) | Yes | - |
| billing_city | VARCHAR(40) | Yes | - |
| billing_state | VARCHAR(40) | Yes | - |
| billing_country | VARCHAR(40) | Yes | - |
| billing_postal_code | VARCHAR(10) | Yes | - |
| total | NUMERIC(10,2) | No | - |
| invoice_line | |||
| invoice_line_id | INT | No | PK |
| invoice_id | INT | No | - |
| track_id | INT | No | - |
| unit_price | NUMERIC(10,2) | No | - |
| quantity | INT | No | - |
| media_type | |||
| media_type_id | INT | No | PK |
| name | VARCHAR(120) | Yes | - |
| playlist | |||
| playlist_id | INT | No | PK |
| name | VARCHAR(120) | Yes | - |
| playlist_track | |||
| playlist_id | INT | No | PK |
| track_id | INT | No | PK |
| track | |||
| track_id | INT | No | PK |
| name | VARCHAR(200) | No | - |
| album_id | INT | Yes | - |
| media_type_id | INT | No | - |
| genre_id | INT | Yes | - |
| composer | VARCHAR(220) | Yes | - |
| milliseconds | INT | No | - |
| bytes | INT | Yes | - |
| unit_price | NUMERIC(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 →