PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sqlite3
import matplotlib.pyplot as plt
""""
Problem Statement:
Suppose we have a database containing information about sales transactions made by a company. The schema of the database includes:
TransactionID (INTEGER, PRIMARY KEY)
ProductID (INTEGER)
ProductName (TEXT)
Quantity (INTEGER)
PricePerUnit (REAL)
SalesDate (TEXT).
analysis tasks:
→ Task 1 : total sales revenue for each product.
→ Task 2 : top 3 best-selling products.
→ Task 3: average price per unit for all products.
"""
# making connection to an in-memory database
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run