Query a Digital Music Store Database (SQLite)
In this project, I am querying the Chinook Database which holds information about a music store. The goal is to assist the Chinook team with understanding the media in their store, their customers and employees, and their invoice information.
As a reference for the database & queries, the schema for the Chinook Database is provided below. There we can see the columns that link tables together via the arrows. This diagram is known as an entity-relationship diagram (ERD), and shows us how data is structured in the database and helps us visualize the data we are analyzing.
The Chinook Database contains the following tables:
Table | Content |
---|---|
Album |
List of tracks and Artist ID |
Artist |
Artist ID and name |
Customer |
Customer data |
Employee |
Employee data |
Genre |
Music genre, for example, rock, blues, latin, etc. |
Invoice |
Invoice data |
Invoiceline |
Invoice item data per line |
MediaType |
For example, MPEG or Protected AAC audio file |
Playlist |
Playlist ID & name |
PlaylistTrack |
Playlist & Track IDs |
Track |
Song data |
The main goal of this project is to use SQL for querying the Chinook database. For the execution of SQL queries I am using DB Browser for SQLite.
The project consists of the following:
-
Writing 4 SQL queries in order to reply to 4 business questions
-
Extracting the data to Excel and create an appropriate visualization for each of the questions
-
Creating a Presentation file to share the findings. This file contains 5 slides for the business questions I am querying the database about.
Business questions
-
- How is Revenue split per Media Type?
-
- Which is the Music Genre that dominates in most countries?
-
- Which are the top 10 Artists that earned the most on 2013?
-
- How did the Revenue for “Rock” genre change during the period 2009-2013?
To run the queries yourself, follow the instructions below:
-
Download the Chinook database from the GitHub site
-
Download the appropriate version of DB Browser for SQLite, depending on your computer setup
-
Connect the Browser to the Database, following the below steps:
- Open up DB Browser for SQLite
- Click on Open Database
- Navigate to the Chinook.db file in the folder where you saved it
- Click on the Execute SQL
- Copy and paste the queries from the txt file or write your own queries to query the data
Notes:
- Although here I am using the DB Browser for SQLite, there are many different SQL database browsers that can work with different types of databases.
- All graphs were created in Google Sheets.