A practical SQL repository by YBI Foundation containing SQL queries, databases, datasets, and end-to-end analytics projects designed for learning and practicing SQL for Data Analysis.
This repository covers SQL fundamentals through advanced analytics concepts using real-world business scenarios such as Marketing Analytics, Retail Sales, and Supply Chain Analytics.
| Project / Dataset | Description |
|---|---|
| Digital Marketing Analytics | SQL queries for analyzing digital marketing performance |
| Marketing Analytics | Marketing dataset and SQL database for analytics practice |
| Marketing Joins | Database designed for practicing SQL JOIN operations |
| QueryMart β Retail Sales | Retail sales database with customers, products, orders, items, and warehouses |
| Supply Chain Analytics | Supply chain dataset for business and operational analysis |
| Supply Chain Advanced Analytics | Advanced supply chain analytics dataset |
QueryMart is a retail business database designed for practicing SQL in a realistic business environment.
The project contains multiple related tables covering:
Customers
Products
Orders
Items
Warehouses
- QueryMart.db
- QueryMartCustomers.csv
- QueryMartProducts.csv
- QueryMartOrders.csv
- QueryMartItems.csv
- QueryMartWarehouses.csv
Using the QueryMart database, learners can answer questions such as:
- What is the total revenue?
- What are the top-selling products?
- Which customers generate the highest revenue?
- What is the average order value?
- Which warehouses generate the most revenue?
- What are the monthly sales trends?
- What are the most expensive orders?
- Which products have the highest sales?
- How does revenue vary by warehouse?
- What is the running total of revenue?
- What is the rank of each warehouse by revenue?
The Digital Marketing Analytics project contains SQL queries for analyzing marketing performance.
The project can be used to practice:
- Marketing campaign analysis
- Customer acquisition analysis
- Conversion analysis
- Revenue analysis
- Campaign performance
- Channel performance
- Aggregations
- Filtering
- Grouping
- Subqueries
- CASE statements
- Window functions
The Marketing Analytics database provides a structured dataset for practicing SQL-based business analysis.
This project can be used to practice:
SELECTWHEREORDER BYGROUP BYHAVING- Aggregate Functions
CASE- String Functions
- Date Functions
- Subqueries
JOIN- Window Functions
- Business KPIs
MarketingJoin.db is designed specifically for understanding and practicing SQL joins.
Topics include:
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
SELF JOIN
CROSS JOIN
The database can be used to understand how multiple business tables are connected and how data can be combined for analysis.
The repository also contains supply chain datasets for analyzing operational and business performance.
These datasets can be used to practice analysis around:
- Inventory
- Orders
- Suppliers
- Products
- Warehouses
- Logistics
- Delivery performance
- Supply chain efficiency
- Operational KPIs
- Business performance
This repository can be followed progressively:
SELECT
WHERE
DISTINCT
ORDER BY
LIMIT
Aliases
Aggregate Functions
String Functions
Date Functions
Mathematical Functions
CASE Statements
GROUP BY
HAVING
COUNT
SUM
AVG
MIN
MAX
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
SELF JOIN
CROSS JOIN
Subqueries
CTEs
Window Functions
RANK()
DENSE_RANK()
ROW_NUMBER()
LAG()
LEAD()
Running Totals
Revenue Analysis
Customer Analysis
Product Analysis
Marketing Analytics
Supply Chain Analytics
Sales Analytics
Performance Analysis
KPI Analysis
The .db files are SQLite databases and can be opened using:
- Python
- Jupyter Notebook
- Google Colab
- SQLite
- DB Browser for SQLite
- VS Code with SQLite extensions
import sqlite3
import pandas as pd
conn = sqlite3.connect("QueryMart.db")
query = """
SELECT *
FROM Customers
LIMIT 10;
"""
df = pd.read_sql_query(query, conn)
dfThese databases can also be used with Python for complete data analytics workflows:
SQLite Database
β
SQL
β
Data Extraction
β
Pandas
β
Data Analysis
β
Visualization
β
Business Insights
This makes the repository useful for learners building skills in both SQL and Python Data Analytics.
After working through these projects, learners should be able to:
- Write SQL queries confidently
- Filter and transform data
- Aggregate business data
- Combine multiple tables using JOINs
- Work with dates and strings
- Use conditional logic with
CASE - Write subqueries and CTEs
- Use window functions
- Calculate business KPIs
- Analyze sales and marketing data
- Perform customer and product analysis
- Analyze supply chain performance
- Solve real-world business questions using SQL
For each dataset, follow this workflow:
1. Understand the Business Problem
β
2. Explore the Tables
β
3. Identify Required Columns
β
4. Write SQL Query
β
5. Validate the Result
β
6. Extract Business Insight
β
7. Build Dashboard / Visualization
SQL/
β
βββ DigitalMarketingAnalytics.sql
β
βββ MarketingAnalytics.db
βββ MarketingJoin.db
β
βββ QueryMart.db
βββ QueryMartCustomers.csv
βββ QueryMartItems.csv
βββ QueryMartOrders.csv
βββ QueryMartProducts.csv
βββ QueryMartWarehouses.csv
β
βββ SupplyChainAnalytics.csv
βββ SupplyChainAnalytics.db
β
βββ SupplyChainAdvanceAnalytics.csv
βββ SupplyChainAdvanceAnalytics.db
β
βββ README.md
This repository is suitable for:
- SQL Beginners
- Data Analyst Students
- Business Analytics Students
- College Students
- SQL Interview Preparation
- Data Analytics Portfolio Projects
- Python + SQL Learners
- Aspiring Data Analysts
- Professionals refreshing their SQL skills
git clone https://github.com/YBIFoundation/SQL.gitChoose any .db file and open it using SQLite, Python, Jupyter Notebook, Google Colab, or DB Browser for SQLite.
Understand the structure, columns, relationships, and available data.
Write SQL queries to answer analytical questions.
Use the datasets to create:
- SQL projects
- Data analysis reports
- Power BI dashboards
- Python analytics projects
- GitHub portfolio projects
| Project | Format | Focus |
|---|---|---|
| Digital Marketing Analytics | .sql |
Marketing |
| Marketing Analytics | .db |
Business Analytics |
| Marketing Join Practice | .db |
SQL JOINs |
| QueryMart Retail Analytics | .db + .csv |
Retail Sales |
| Supply Chain Analytics | .db + .csv |
Supply Chain |
| Supply Chain Advanced Analytics | .db + .csv |
Advanced Analytics |
If you find this repository useful for learning SQL:
β Star this repository
π΄ Fork the repository
π’ Share it with other learners
π» Build your own project using the datasets
This repository is part of the practical learning resources developed by YBI Foundation for students and aspiring data professionals.
Learn. Practice. Build. Deploy.
YBI Foundation
This repository is intended for educational and learning purposes.
Please refer to the repository and individual dataset files for any applicable usage restrictions.