Skip to content
Free courses
Data AnalysisBeginnerFree

Ask and Answer a Data Question with SQL and Python

You will ask a clear question about a small sales dataset, load it into SQLite, query it with SQL, analyse the result with Python, and create a bar chart to show the answer.

6 lessons 41 minNo account needed

Start lesson 1

What you will learn

  • Formulate a precise question about a dataset that can be answered with data.
  • Create a small CSV dataset and load it into SQLite using Python.
  • Write SQL queries to filter and aggregate data.
  • Use Python to run SQL queries and prepare results for a chart.
  • Create a simple SVG bar chart from query results and present the answer.

Before you start

  • Use a text editor to create and save plain text files.
  • Run Python scripts from a terminal or command prompt.
  • Read and write simple Python code with variables, loops, and functions.

Lessons

  1. Lesson 1: Write a Question and Create Sample Sales DataYou choose a question you can answer with sales data, define each term, and create a small CSV file with columns for date, item, quantity, and unit price.5 min
  2. Lesson 2: Load the CSV into SQLite with PythonYou write a Python script that reads your CSV file and creates an SQLite database table, then checks the row count.7 min
  3. Lesson 3: Query the Data with SQLYou write SQL queries against your SQLite database to filter, group, and calculate total revenue per item.8 min
  4. Lesson 4: Run the Query from Python and Prepare ResultsYou modify your Python script to run the SQL query, fetch the results, and format them as a list of item names and revenue amounts.9 min
  5. Lesson 5: Create a Clear Bar Chart with SVGYou write Python code that turns the query results into a simple SVG bar chart saved as an HTML file you can open in a browser.5 min
  6. Lesson 6: Assemble the Analysis into a Small ReportYou combine the question, SQL query, result table, and chart into a single short document or script output that answers your question.7 min
1,564 open data analyst roles on Rolebound right nowSee the roles

Ready to use this in a job?

Rolebound applies to matching roles for you.

    Cookies on Rolebound

    We use necessary cookies to sign you in and keep the site working — those cannot be turned off. We would also like to set analytics and advertising cookies so we can see which pages help people get interviews and which adverts brought them here. Nothing optional is set unless you say yes, and you can change your mind at any time from “Cookie settings” in the footer. Read our Privacy Policy.