A comprehensive collection of SQL projects demonstrating database design, complex queries, data analysis, and business intelligence solutions.
- About
- Projects Overview
- Skills Demonstrated
- Database Technologies
- Setup Instructions
- Project Details
- Key Learnings
- Contact
This repository showcases my SQL expertise through various projects involving database design, data manipulation, complex querying, and analytics. Each project addresses real-world business problems and demonstrates industry-standard database practices.
Focus Areas:
- Database schema design and normalization
- Complex SQL queries and joins
- Data analysis and reporting
- Performance optimization
- Business intelligence solutions
Business Problem: Understand employee demographics, attrition, and department performance
Database: PostgreSQL
Key Queries:
- Department-wise headcount and salary analysis
- Employee turnover rate calculations
- Performance rating distributions
- Salary gap analysis by role and department
Skills Used: GROUP BY, HAVING, Aggregations, Date Functions
- β DDL (Data Definition Language): CREATE, ALTER, DROP
- β DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE
- β Complex Joins: INNER, LEFT, RIGHT, FULL OUTER, CROSS, SELF
- β Aggregation Functions: COUNT, SUM, AVG, MIN, MAX
- β Window Functions: ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD
- β CTEs: Common Table Expressions for readable queries
- β Subqueries: Correlated and non-correlated subqueries
- β Views: Creating reusable virtual tables
- β Indexes: Query optimization strategies
- β Stored Procedures: Reusable SQL code blocks
- Database normalization (1NF, 2NF, 3NF, BCNF)
- Entity-Relationship (ER) modeling
- Query optimization and performance tuning
- Transaction management (ACID properties)
- Data integrity constraints (Primary Keys, Foreign Keys, Unique, Check)
| Database | Version | Use Cases |
|---|---|---|
| MySQL | 8.0+ | E-commerce, General analytics |
| PostgreSQL | 14+ | Complex queries, Advanced analytics |
- MySQL 8.0+ or PostgreSQL 14+
- MySQL Workbench / pgAdmin / DBeaver (Database GUI)
- Git
- Clone the repository
git clone https://github.com/nushant22/SQL-Analytics-Portfolio.git
cd SQL-Analytics-Portfolio-
Choose a database system (MySQL or PostgreSQL)
-
Create database and import data
# Login to MySQL
mysql -u root -p
# Create database
CREATE DATABASE project_name;
# Import SQL dump
mysql -u root -p project_name < project_folder/schema.sql
mysql -u root -p project_name < project_folder/data.sql# Login to PostgreSQL
psql -U postgres
# Create database
CREATE DATABASE project_name;
# Import SQL dump
psql -U postgres -d project_name -f project_folder/schema.sql
psql -U postgres -d project_name -f project_folder/data.sql- Run queries Navigate to the specific project folder and execute the SQL files in your database client.
SQL-Analytics-Portfolio/
β
β
βββ hr_analytics/
β βββ schema.sql
β βββ data.sql
β βββ queries.sql
β βββ README.md
β
βββ README.md
-- Calculate running total of sales by salesperson
SELECT
s.salesperson_name,
o.order_date,
o.order_amount,
SUM(o.order_amount) OVER (
PARTITION BY s.salesperson_id
ORDER BY o.order_date
) AS running_total
FROM
orders o
JOIN
salespersons s ON o.salesperson_id = s.salesperson_id
ORDER BY
s.salesperson_name, o.order_date;-- Segment customers by purchase frequency
WITH customer_metrics AS (
SELECT
customer_id,
COUNT(order_id) AS total_orders,
SUM(order_amount) AS total_spent,
AVG(order_amount) AS avg_order_value
FROM orders
GROUP BY customer_id
)
SELECT
customer_id,
total_orders,
total_spent,
CASE
WHEN total_orders >= 10 THEN 'VIP'
WHEN total_orders >= 5 THEN 'Regular'
ELSE 'Occasional'
END AS customer_segment
FROM customer_metrics
ORDER BY total_spent DESC;Each project includes:
- Problem Statement: Clear business question to answer
- Data Analysis: SQL queries to extract insights
- Visualizations: Charts and graphs (where applicable)
- Recommendations: Data-driven business recommendations
- π Identified top 20% products generating 80% revenue (Pareto principle)
- π₯ Discovered customer retention rate dropped 15% in Q4
- π° Found opportunity to increase revenue by 12% through cross-selling
- π Revealed highest-performing regions for targeted marketing
Through these SQL projects, I've developed:
- Strong foundation in relational database concepts
- Ability to design normalized database schemas
- Proficiency in writing complex, optimized SQL queries
- Experience with real-world business analytics scenarios
- Understanding of database performance optimization
- Skills in translating business requirements to SQL
- Capability to derive actionable insights from data
- Basic SQL (SELECT, WHERE, ORDER BY)
- Joins and Relationships
- Aggregations and GROUP BY
- Subqueries and CTEs
- Window Functions
- Performance Optimization
Suggestions and improvements are welcome! Feel free to:
- Report issues
- Suggest new project ideas
- Improve existing queries
- Add new analysis scenarios
This project is licensed under the MIT License - see the LICENSE file for details.
Nushant Ghimire
- LinkedIn: nushant-ghimire-861b87325
- GitHub: @nushant22
- Email: [nushantghimire22@gmail.com]
β Found this helpful? Star this repository!
πΌ Looking for a data analyst/SQL developer? Let's connect!
Last Updated: February 2026