Querying with SQL and Python

Connect Python to the Chinook SQLite database and write SQL queries to answer real business questions.

Start building, submit solution and get feedback from the community.
2Submit Solution
5 upvotes10 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 sqlite3 library

  • Explore 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

Join the Community

roadmap.sh is the 6th most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Rank 6th聽out of 28M!

352K

GitHub Stars

Star us on GitHub
Help us reach #1

+90kevery month

+2.8M

Registered Users

Register yourself
Commit to your growth

+2kevery month

46K

Discord Members

Join on Discord
Join the community

RoadmapsGuidesFAQsYouTube

roadmap.shby@kamrify

Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.

漏 roadmap.shTermsPrivacy

ThewNewStack

The top DevOps resource for Kubernetes, cloud-native computing, and large-scale development and deployment.