SQLite Sample Database

Created with Sketch.

SQLite Sample Database

Summary: in this tutorial, we first introduce you to an SQLite sample database. Then, we will give you the links to download the sample database and its diagram. At the end of the tutorial, we will show you how to connect to the sample database using the sqlite3 tool.

Introduction to chinook SQLite sample database

We provide you with the SQLite sample database named chinook. The chinook sample database is a good database for practicing with SQL, especially SQLite.

The following database diagram illustrates the chinook database tables and their relationships.

Chinook sample database tables

There are 11 tables in the chinook sample database.

  •  employees table stores employees data such as employee id, last name, first name, etc. It also has a field named ReportsTo to specify who reports to whom.
  •  customers table stores customers data.
  •  invoices & invoice_items tables: these two tables store invoice data. The invoices table stores invoice header data and the invoice_items table stores the invoice line items data.
  •  artists table stores artists data. It is a simple table that contains only the artist id and name.
  •  albums table stores data about a list of tracks. Each album belongs to one artist. However, one artist may have multiple albums.
  •  media_types table stores media types such as MPEG audio and AAC audio files.
  •  genres table stores music types such as rock, jazz, metal, etc.
  •  tracks table stores the data of songs. Each track belongs to one album.
  •  playlists & playlist_track tables: playlists table store data about playlists. Each playlist contains a list of tracks. Each track may belong to multiple playlists. The relationship between the playlists table and tracks table is many-to-many. The playlist_track table is used to reflect this relationship.

Download SQLite sample database

You can download the SQLite sample database using the following link.

Download SQLite sample database

In case you want to have the database diagram for reference, you can download both black&white and color versions in PDF format.

Download SQLite sample database diagram

Download SQLite sample database diagram with color

How to connect to SQLite sample database

The sample database file is ZIP format, therefore, you need to extract it to a folder, for example, C:\sqlite\db. The name of the file is chinook.db

If you don’t have zip software installed, you can download a free zip software such as 7-zip.

First, use the command line program and navigate to the SQLite directory where the sqlite3.exe file is located:


Code language: Shell Session (shell)

Second, use the following command to connect to the chinook sample database located in the db folder, which is a subfolder of the sqlite folder.

c:\sqlite>sqlite3 c:\sqlite\db\chinook.db

Code language: Shell Session (shell)

You should see the following command:


Code language: Shell Session (shell)

Third, try a simple command e.g., .tables to view all the tables available in the sample database.

sqlite> .tables
albums employees invoices playlists
artists genres media_types tracks
customers invoice_items playlist_track

Code language: SQL (Structured Query Language) (sql)

In this tutorial, we have introduced you to the chinook SQLite sample database and showed you how to connect to it using the sqlite3 tool.

Leave a Reply

Your email address will not be published. Required fields are marked *