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.
employeestable stores employees data such as employee id, last name, first name, etc. It also has a field named
ReportsToto specify who reports to whom.
customerstable stores customers data.
invoice_itemstables: these two tables store invoice data. The
invoicestable stores invoice header data and the
invoice_itemstable stores the invoice line items data.
artiststable stores artists data. It is a simple table that contains only artist id and name.
albumstable stores data about a list of tracks. Each album belongs to one artist. However, one artist may have multiple albums.
media_typestable stores media types such as MPEG audio file, ACC audio file, etc.
genrestable stores music types such as rock, jazz, metal, etc.
trackstable store the data of songs. Each track belongs to one album.
playliststable store data about playlists. Each playlist contains a list of tracks. Each track may belong to multiple playlists. The relationship between the
trackstable is many-to-many. The
playlist_tracktable is used to reflect this relationship.
Download SQLite sample database
You can download the SQLite sample database using the following link.
In case you want to have the database diagram for reference, you can download both black&white and color versions in PDF format.
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, you use command prompt window and navigate to the SQLite installation folder where the sqlite3.exe file is located.
Second, you use the following command to connect to the chinook sample database located in the
db folder, which is a subfolder of the
You should see the following command:
Third, you can try a simple command e.g., .tables to view all the tables available in the sample database.
albums employees invoices playlists
artists genres media_types tracks
customers invoice_items playlist_track
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.