An open API service indexing awesome lists of open source software.

https://github.com/devlm7/7_sqlite_db

The goal is to create a small SQLite database in Python, insert sample sales data, perform simple SQL queries to get total quantity sold and revenue per product, and visualize the results using a bar chart. It’s a great hands-on exercise for combining SQL, pandas, and matplotlib in a Python script.
https://github.com/devlm7/7_sqlite_db

Last synced: about 1 year ago
JSON representation

The goal is to create a small SQLite database in Python, insert sample sales data, perform simple SQL queries to get total quantity sold and revenue per product, and visualize the results using a bar chart. It’s a great hands-on exercise for combining SQL, pandas, and matplotlib in a Python script.

Awesome Lists containing this project

README

          

# 🧾 SQLite Sales Summary in Python

This project demonstrates how to:

- Create a SQLite database using Python
- Store and query basic sales data
- Summarize and visualize sales using SQL, pandas, and matplotlib

## πŸ“¦ Project Overview

The script performs the following:

1. Creates a SQLite database `sales_data.db`
2. Creates a `sales` table and inserts sample data
3. Calculates total quantity sold and revenue for each product using SQL
4. Loads the results into a pandas DataFrame
5. Displays a printed summary and a bar chart of revenue by product

## πŸ› οΈ Tools Used

- **Python 3**
- **SQLite (via `sqlite3`)**
- **pandas**
- **matplotlib**

## πŸ“‚ Files

- `online_sales_data.py` – Main script that runs the entire workflow
- `sales_data.db` – SQLite database file (created automatically when the script runs)
- `sales_chart.png` – Bar chart of revenue by product (saved automatically)

## βœ… Learning Outcomes

- Working with SQLite databases in Python
- Writing basic SQL aggregation queries
- Importing SQL query results into pandas
- Visualizing summaries with matplotlib