{"id":89,"date":"2015-11-29T11:45:31","date_gmt":"2015-11-29T04:45:31","guid":{"rendered":"https:\/\/web.archive.org\/web\/20211010142626\/http:\/\/www.sqlitetutorial.net\/?page_id=89"},"modified":"2020-07-03T08:22:33","modified_gmt":"2020-07-03T01:22:33","slug":"sqlite-sample-database","status":"publish","type":"page","link":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/","title":{"rendered":"SQLite Sample Database"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: 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.<\/p>\n\n\n\n<h2>Introduction to chinook SQLite sample database<\/h2>\n\n\n\n<p>We provide you with the SQLite sample database named chinook.&nbsp;The chinook sample database is a good database for practicing with SQL, especially SQLite.<\/p>\n\n\n\n<p>The following database diagram illustrates the chinook database tables and their relationships.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"800\" height=\"402\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg\" alt=\"SQLite Sample Database\" class=\"wp-image-593\" srcset=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg 800w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color-300x151.jpg 300w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color-768x386.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h3>Chinook sample database tables<\/h3>\n\n\n\n<p>There are 11 tables in the chinook sample database.<\/p>\n\n\n\n<ul><li>&nbsp;<code>employees<\/code> table stores employees data&nbsp;such as employee id, last name, first name, etc. It also has a field named <code>ReportsTo<\/code> to specify&nbsp;who reports to whom.<\/li><li>&nbsp;<code>customers<\/code> table stores customers data.<\/li><li>&nbsp;<code>invoices<\/code> &amp; <code>invoice_items<\/code> tables: these two tables store invoice data. The <code>invoices<\/code> table stores invoice header data and the <code>invoice_items<\/code> table stores the invoice line items data.<\/li><li>&nbsp;<code>artists<\/code> table stores artists data. It is a simple table that contains only the artist id and name.<\/li><li>&nbsp;<code>albums<\/code> table stores data about a list of tracks. Each album belongs to one artist. However, one artist may have multiple albums.<\/li><li>&nbsp;<code>media_types<\/code> table stores media types such as MPEG audio and AAC audio files.<\/li><li>&nbsp;<code>genres<\/code> table stores music types such as rock, jazz, metal, etc.<\/li><li>&nbsp;<code>tracks<\/code> table stores the data of songs. Each track belongs to one album.<\/li><li>&nbsp;<code>playlists<\/code> &amp; <code>playlist_track<\/code> tables: <code>playlists<\/code> table store data about playlists. Each playlist contains a list of tracks. Each track may belong to multiple playlists. The relationship between the <code>playlists<\/code> table and <code>tracks<\/code> table is many-to-many. The <code>playlist_track<\/code> table is used to reflect this relationship.<\/li><\/ul>\n\n\n\n<h2>Download SQLite sample database<\/h2>\n\n\n\n<p>You can download the SQLite sample database using the following link.<\/p>\n\n\n\n<p><a class=\"buttonDownload\" href=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/03\/chinook.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Download SQLite sample database<\/a><\/p>\n\n\n\n<p>In case you want to have the database diagram for reference, you can download both black&amp;white and color versions in PDF format.<\/p>\n\n\n\n<p><a class=\"buttonDownload\" href=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/03\/sqlite-sample-database-diagram.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Download SQLite sample database diagram<\/a><\/p>\n\n\n\n<p><a class=\"buttonDownload\" href=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/03\/sqlite-sample-database-diagram-color.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Download SQLite sample database diagram with color<\/a><\/p>\n\n\n\n<h2>How to connect to SQLite sample database<\/h2>\n\n\n\n<p>The sample database file is ZIP format, therefore, you need to extract it to a folder, for example, <code>C:\\sqlite\\db<\/code>. The name of the file is <code>chinook.db<\/code><\/p>\n\n\n\n<p class=\"note\">If you don&#8217;t have zip software installed, you can download a <a href=\"http:\/\/www.7-zip.org\/\">free zip software such as 7-zip<\/a>.<\/p>\n\n\n\n<p>First, use the command line program and navigate to the SQLite directory where the sqlite3.exe file is located:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Shell Session\" data-shcb-language-slug=\"shell\"><div><code class=\"hljs language-shell\">c:\\sqlite&gt;<\/code><\/div><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Shell Session<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">shell<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, use the following command to connect to the <code>chinook<\/code> sample database located in the <code>db<\/code> folder, which is a subfolder of the <code>sqlite<\/code> folder.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Shell Session\" data-shcb-language-slug=\"shell\"><div><code class=\"hljs language-shell\">c:\\sqlite&gt;sqlite3 c:\\sqlite\\db\\chinook.db<\/code><\/div><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Shell Session<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">shell<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You should see the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Shell Session\" data-shcb-language-slug=\"shell\"><div><code class=\"hljs language-shell\"><span class=\"hljs-meta\">sqlite&gt;<\/span><\/code><\/div><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Shell Session<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">shell<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, try a simple <a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-commands\/\">command<\/a> e.g., .tables to view all the tables available in the sample database.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><div><code class=\"hljs language-sql\">sqlite&gt; .tables\nalbums          employees       invoices        playlists\nartists         genres          media_types     tracks\ncustomers       invoice_items   playlist_track<\/code><\/div><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>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.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"89\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\"\n\t\t\t\tdata-post-title=\"SQLite Sample Database\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"89\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\"\n\t\t\t\tdata-post-title=\"SQLite Sample Database\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQLite Sample Database And Its Diagram (in PDF format)<\/title>\n<meta name=\"description\" content=\"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQLite Sample Database And Its Diagram (in PDF format)\" \/>\n<meta property=\"og:description\" content=\"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\" \/>\n<meta property=\"og:site_name\" content=\"SQLite Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-03T01:22:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\",\"url\":\"https:\/\/www.sqlitetutorial.net\/\",\"name\":\"SQLite Tutorial\",\"description\":\"A Step-by-step SQLite Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlitetutorial.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg\",\"contentUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg\",\"width\":800,\"height\":402},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#webpage\",\"url\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\",\"name\":\"SQLite Sample Database And Its Diagram (in PDF format)\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#primaryimage\"},\"datePublished\":\"2015-11-29T04:45:31+00:00\",\"dateModified\":\"2020-07-03T01:22:33+00:00\",\"description\":\"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLite Tutorial\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQLite Sample Database\"}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQLite Sample Database And Its Diagram (in PDF format)","description":"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/","og_locale":"en_US","og_type":"article","og_title":"SQLite Sample Database And Its Diagram (in PDF format)","og_description":"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool","og_url":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/","og_site_name":"SQLite Tutorial","article_modified_time":"2020-07-03T01:22:33+00:00","og_image":[{"url":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg"}],"twitter_card":"summary","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/#website","url":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/","name":"SQLite Tutorial","description":"A Step-by-step SQLite Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#primaryimage","inLanguage":"en-US","url":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg","contentUrl":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/11\/sqlite-sample-database-color.jpg","width":800,"height":402},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#webpage","url":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/","name":"SQLite Sample Database And Its Diagram (in PDF format)","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#primaryimage"},"datePublished":"2015-11-29T04:45:31+00:00","dateModified":"2020-07-03T01:22:33+00:00","description":"You can download a SQLite sample database and its diagram to practice with SQLite. You will also learn how to connect to the database using sqlite3 tool","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQLite Tutorial","item":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":3,"name":"SQLite Sample Database"}]}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/89"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":0,"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/89\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/2"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/media?parent=89"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20211010142626\/https:\/\/api.w.org\/{rel}","templated":true}]}}