Querying with SQL and Python
Connect Python to the Chinook SQLite database and write SQL queries to answer real business questions.
5 upvotes
10 upvotes
In this project, you will connect Python to the Chinook database, a sample SQLite database that represents a small digital music store. You will write SQL queries directly from a Jupyter Notebook to explore the data and answer business questions.
Because SQLite needs no server or configuration, this is the easiest way to learn SQL alongside Python.
Project Requirements
Download the Chinook database file and connect to it using Python's
sqlite3libraryExplore the database schema: identify all tables and their relationships
Write SQL queries to answer the following questions:
Which are the 10 best-selling tracks?
Which country generates the most revenue?
Who is the top-performing sales employee?
Load query results into Pandas DataFrames
Visualize at least one result with a bar chart
Technologies to Use
Python
sqlite3
Pandas
Matplotlib
Jupyter Notebook
What You Will Learn
You will learn how to write SELECT, JOIN, GROUP BY, and ORDER BY statements and how to move data from SQL into Pandas for visualization. You will also understand when SQL is more convenient than Pandas for querying structured data.
Want to See a Solution?
A full walkthrough of this project is available on Towards Data Science: 馃敆 SQL in Data Science
