Project Introduction: Chinook Database
Project Introduction: Chinook Database
Project Introduction: Chinook Database
SEARCH
RESOURCES
CONCEPTS
Project Introduction
SEND FEEDBACK
Chinook Database
Introduction
In this project, you will query the Chinook Database. The Chinook Database holds
information about a music store. For this project, you will be assisting the Chinook team with
understanding the media in their store, their customers and employees, and their invoice
information. To assist you in the queries ahead, the schema for the Chinook Database is
provided below. You can see the columns that link tables together via the arrows.
All of the below instructions are discussed in detail as we work through this lesson on your
way to completing this project. The below serves as a quick reference of what you will be
doing as you progress through the completion of this project.
Instructions
You will need to follow the instructions on the next three concepts to get the Chinook
database up and running on your own machine, and check that it is set up correctly. There
will be two parts to this project.
1. The first part is a series of questions that will assure you have mastered the
main concepts taught throughout the SQL lessons. Though these questions will not be
"graded" by a reviewer, they will help you self assess.
2. The second part is a presentation. Similar to the first project, there isn't a
'right answer' for the second portion of the project. You have the ability to be creative in the
questions you ask. You will then write a SQL query to pull the data needed to successfully
answer your question. Use the pulled data to build a visual (bar chart, histogram, or another
plot) that answers your question. The essentials of your project submission are discussed in
the next sections. In order to review your presentation, you will need to save your
slides as a PDF .
Project Walkthrough
This video shows one of our instructors giving some great hints and tips for how to get
started with your project: Walkthrough Video
NEXT
Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Peer Chat
Chat with peers and alumni
The next few problems are going to help make sure you are comfortable working locally.
Once you're set up you'll be able to use this workspace not only for this project...but
BEYOND!
The environment we'll use is pretty quick to set up and hopefully you'll be up and running in
no time :)
NEXT
Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Checking Setup
SEND FEEDBACK
SUBMIT ANSWER
NEXT
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Schema Match
SEND FEEDBACK
QUIZ QUESTION
InvoiceID
UnitPrice
BillingAddress
Name
BillingPostalCode
SUBMIT
NEXT
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Peer Chat
Chat with peers and alumni
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Peer Chat
Chat with peers and alumni
Question 1
Use your query to return the email, first name, last name, and Genre of all Rock Music
listeners. Return your list ordered alphabetically by email address starting with A .
I chose to link information from the Customer, Invoice, InvoiceLine, Track,
and Genre tables, but you may be able to find another way to get at the information.
Let's invite the artists who have written the most rock music in our dataset. Write a query
that returns the Artist name and total track count of the top 10 rock bands.
You will need to use the Genre, Track , Album, and Artist tables.
Check Your Solution
The top 10 bands are shown below along with the number of songs each band has on
record.
Question 3
First, find which artist has earned the most according to the InvoiceLines?
Now use this artist to find which customer spent the most on this artist.
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Peer Chat
Chat with peers and alumni
Advanced SQL
To solve the questions here, you will need to write a query that extends beyond the content
covered in these lessons. These questions are simply here to show you that there are
extensions of the material we have already covered, but you definitely have the building
blocks to tackle these tougher topics! These questions are given as additional material
to challenge you! Each of the below require the tools you are already familiar with, but
they also use a new method known as a SUBQUERY.
Question 1
We want to find out the most popular music Genre for each country. We determine the most
popular genre as the genre with the highest amount of purchases. Write a query that returns
each country along with the top Genre. For countries where the maximum number of
purchases is shared return all Genres.
Question 3
Write a query that determines the customer that has spent the most on music for each
country. Write a query that returns the country along with the top customer and how much
they spent. For countries where the top amount spent is shared, provide all customers who
spent this amount.
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
For this query we wanted only the year and month %Y stands for year and %m stands for
month. The full list of what is below.
%d - day of month: 00
%H - hour: 00-24
%m - month: 01-12
%M - minute: 00-59
%S - seconds: 00-59
%Y - year: 0000-9999
Here are some helpful links to assist with working with dates in SQLite.
https://www.techonthenet.com/sqlite/functions/strftime.php
https://sqlite.org/lang_datefunc.html
Should you have to work another SQL environment in the future, like Microsoft SQL Server,
Oracle, MySQL, or any other SQL environment; there are likely to again be subtle
differences. With your current skills, a quick Google search will likely help you be able your
transfer what you know to work with any of these environments very quickly.
If you are still having difficulty using date functions in SQLite and want to use it in your
project please ask a question in Study Groups .
NEXT
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Peer Chat
Chat with peers and alumni
Project submission
Presentations
You are now on the portion of the project you will need to submit to a reviewer. To pass this
project follow the below instructions to create a presentation.
Four slides
One visualization per slide
A 1-2 sentence explanation of each slide
The SQL query used to create the data used in the visualization.
Note: you may choose to use queries that were motivated by the questions on the
previous concepts, or you may choose four entirely new questions. However, if you
use any of the previous queries, they must be those that had a JOIN as stated in
the Rubric.
The submission template is a Google Slides file. Make a copy of the submission template to
complete your project. We suggest you use the layout provided, though it is not a
requirement.
Queries
Please include a text file that includes each of the queries used to create the visualizations.
You should format your queries for readability, use this tool to help http://www.sql-
format.com/. In a plain text file (use notepad, notepad++, or atom).
Put your text file and presentation in a folder and zip it. Then submit the zipped folder
for your project. A slide template is provided here:
SUBMISSION TEMPLATE
If you cannot access Google Slides please scroll to the bottom to download the power point file
of the template.
Visualizations
We suggest you use a spreadsheet application, such as Excel or Google Sheets to create
your visualizations. However, you’re welcome to use whatever tool you’d like. Your
visualizations could be any that you learned about in the previous lesson. Below is one
example, and a link has been provided to an example slide.
You should have four slides that are similar to the below submission, but the questions you
ask are up to you, and all four of your final submitted queries should contain
a JOIN and AGGREGATION. Look at the Rubric to verify you have met all of necessities
for this submission.
SUBMISSION SLIDE EXAMPLE
In order to create the visualizations like those shown in the link above, you will need to
move your data out of SQL and into Excel (or another spreadsheet application).
Select Export to CSV, and then select the settings that match the ones below. Make sure
your setting on New line characters is set to Unix: LF(\n) .
Additional Guidelines
There shouldn’t be any additional data prep (sorting, filtering, renaming, etc.)
between the query output and the visualization.
All your four queries must include at least one join and an aggregation.
Review your project against the project Rubric. Reviewers will use this to evaluate
your work.
The first part of this project is aimed at helping you understand the database, so you
can ask interesting questions in the second part. Feel free to use and expand upon the
queries you wrote in the first part.
Once you've finished your project, submit the presentation as a PDF and the queries
as a .txt file.
Don't be afraid to challenge yourself! Try to combine the SQL concepts you know!
In order to review your presentation, you will need to save your slides as a PDF . You
can do this from within Google Slides by selecting File > Download as > PDF Document.
Supporting Materials
SQL Project Submission Template
NEXT
; Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
Common Mistakes
SEND FEEDBACK
Invoice.Total
This contains the total amount a customer paid in the transaction. A customer may have
bought several different genres, albums, and songs in one transaction.
So if you are looking for the amount of genre sales you will need to use Invoiceline to
calculate it since just using Invoice.Total might contain multiple genres
Aggregations
Be careful with Aggregations! You need to include all of the columns you are returning other
than the aggregation in your group by statement.
Right:
Wrong:
SubQueries
Subqueries are awesome but you should not use them if you do not need it to answer the
question you asked. Many times the first question that is thought of does not require one.
You may need to think of a few more to find a complex question that necessitates a
subquery. Though writing a subquery is not required, you are encouraged to challenge
yourself if you would like to submit a subquery!
Joins
Joins in general should be from a Primary key to it's corresponding Foreign key
Right: ON Track.TrackId = InvoiceLine.TrackId
Track PrimaryKey = InvoiceLine ForeignKey for Track
Unrecognized Token
You may get an error that says "unrecognized token" the reason for this is the different uses
of single and double quotes around words in your query.
In SQLite "" are used to denote strings and '' are used to denote columns(though this is
rare, but sometimes people will have column names with spaces in them and so using the ''
allows you to still reference that column
NEXT
;
Project:SQL Project
SEARCH
RESOURCES
CONCEPTS
1. 1. Project Introduction
SQL Project
SUBMIT PROJECT
Project Submission
Have project questions? Ask a technical mentor or search for existing answers!
ASK A MENTOR
DUE DATE
Mar 11
STATUS
Unsubmitted
Project past due
To submit your project, please do the following:
Review your project against the project Rubric. Reviewers will use this to evaluate
your work.
Create your slides with whatever presentation software you'd like (e.g. Google
Slides, PowerPoint, Keynote, etc.).
In order to review your presentation, you will need to save your slides as a PDF . You
can do this from within Google Slides by selecting File > Download as > PDF Document.
Create a separate text file with each of the SQL queries used to create the
visualizations.
Save the presentation as a PDF and the SQL queries in a text file(.txt) in the same
folder.
Zip (compress) the folder and submit this zipped folder with both files in it.
Submit the zipped file.