This project demonstrates how to:
- Work with a small sales dataset.
- Store it in a SQLite database.
- Use SQL to aggregate revenue and quantities.
- Read the results into Python/pandas.
- Create a bar chart visualization.
File | Description |
---|---|
sales_data.db |
SQLite database containing the table sales . |
sales.csv |
CSV copy of the same data for reference. |
sql_db_using_python.py |
Python script that connects to the DB, runs queries, prints a summary. |
sales_chart.png |
Bar chart output: revenue by product. |
README.md |
This file β instructions & notes. |
The table sales
contains 12 sample rows:
Column | Type | Description |
---|---|---|
sale_id |
INTEGER | Unique ID for each sale |
date |
TEXT | Date of sale (YYYY-MM-DD) |
product |
TEXT | Product name |
quantity |
INTEGER | Quantity of units sold |
price |
REAL | Unit price in USD |
Example rows:
sale_id | date | product | quantity | price |
---|---|---|---|---|
1 | 2025-09-01 | Widget A | 3 | 19.99 |
4 | 2025-09-02 | Widget A | 5 | 19.99 |
9 | 2025-09-05 | Gizmo D | 10 | 9.99 |
β¦ | β¦ | β¦ | β¦ | β¦ |
Revenue is calculated as quantity * price
.
- Python 3.x
- pandas
- matplotlib
- sqlite3 (built-in with Python)
Install the Python packages if needed:
pip install pandas matplotlib