Skip to content

Comprehensive SQL portfolio showcasing database design, complex queries, data analysis, and business intelligence solutions using MySQL and PostgreSQL. Demonstrates expertise in database management and analytics.

Notifications You must be signed in to change notification settings

nushant22/SQL-Analytics-Portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š SQL Analytics Portfolio

A comprehensive collection of SQL projects demonstrating database design, complex queries, data analysis, and business intelligence solutions.

SQL Database License

πŸ“‹ Table of Contents

🎯 About

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

πŸ—‚οΈ Projects Overview

2. [HR Analytics] - HR Employee Analytics

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

πŸ”§ Skills Demonstrated

Core SQL Skills

  • βœ… 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

Advanced Concepts

  • 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 Technologies

Database Version Use Cases
MySQL 8.0+ E-commerce, General analytics
PostgreSQL 14+ Complex queries, Advanced analytics

πŸš€ Setup Instructions

Prerequisites

  • MySQL 8.0+ or PostgreSQL 14+
  • MySQL Workbench / pgAdmin / DBeaver (Database GUI)
  • Git

Installation Steps

  1. Clone the repository
git clone https://github.com/nushant22/SQL-Analytics-Portfolio.git
cd SQL-Analytics-Portfolio
  1. Choose a database system (MySQL or PostgreSQL)

  2. Create database and import data

For MySQL:

# 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

For PostgreSQL:

# 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
  1. Run queries Navigate to the specific project folder and execute the SQL files in your database client.

πŸ“Š Project Details

Project Structure

SQL-Analytics-Portfolio/
β”‚
β”‚
β”œβ”€β”€ hr_analytics/
β”‚   β”œβ”€β”€ schema.sql
β”‚   β”œβ”€β”€ data.sql
β”‚   β”œβ”€β”€ queries.sql
β”‚   └── README.md
β”‚
└── README.md

Sample Query Examples

Complex JOIN with Window Function

-- 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;

CTE for Customer Segmentation

-- 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;

πŸ“ˆ Key Business Insights

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

Example Insights:

  • πŸ“Š 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

πŸŽ“ Key Learnings

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

πŸ“š Additional Resources

Helpful Links:

Learning Path:

  1. Basic SQL (SELECT, WHERE, ORDER BY)
  2. Joins and Relationships
  3. Aggregations and GROUP BY
  4. Subqueries and CTEs
  5. Window Functions
  6. Performance Optimization

🀝 Contributing

Suggestions and improvements are welcome! Feel free to:

  • Report issues
  • Suggest new project ideas
  • Improve existing queries
  • Add new analysis scenarios

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“§ Contact

Nushant Ghimire


⭐ Found this helpful? Star this repository!

πŸ’Ό Looking for a data analyst/SQL developer? Let's connect!

Last Updated: February 2026

About

Comprehensive SQL portfolio showcasing database design, complex queries, data analysis, and business intelligence solutions using MySQL and PostgreSQL. Demonstrates expertise in database management and analytics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published