Skip to content

A collection of SQL queries and insights analyzing employee and department data, showcasing aggregation, joins, window functions, and real-world business problem solving.

Notifications You must be signed in to change notification settings

shivharebhupendra/employee-sql-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

employee-sql-analytics

A collection of SQL queries and insights analyzing employee and department data, showcasing aggregation, joins, window functions, and real-world business problem solving.


๐Ÿ“˜ SQL Practice Project โ€“ Employee & Project Management System

This project contains 38 SQL questions, including queries, joins, subqueries, window functions, CTEs, triggers, procedures, transactions, indexing, and views. It also includes business insights derived from the outputs.


๐Ÿ—๏ธ Database Structure

  • Employees Table

    • Stores employee info like department, salary, manager, and join date.
  • Projects Table

    • Stores project assignments, hours worked, and rating.

๐ŸŽฏ Covered SQL Concepts

  • โœ” Basic Queries
  • โœ” Joins (INNER, LEFT, RIGHT)
  • โœ” Aggregations
  • โœ” Subqueries
  • โœ” Window Functions
  • โœ” CTEs + Recursive CTEs
  • โœ” Stored Functions
  • โœ” Stored Procedures
  • โœ” Transactions
  • โœ” Triggers
  • โœ” Views
  • โœ” Indexing
  • โœ” Case Statements
  • โœ” Salary Categorization
  • โœ” Performance Insights

๐Ÿ“Š Key Insights from All Queries

    1. Employee Patterns
    • Highest Salary: Meera (95,000)

    • Second Highest Salary: Karan (90,000)

    • IT department has 3 employees โ€” highest count

    • Highest total hours: John (226 hours) across 4 projects

    • HR avg salary = 67,500 (Aisha < avg, Karan > avg)

    • IT avg salary = 75,000

    • Finance avg salary = 60,000

    1. Department-Level Insights
    • Department with highest total salary: IT (230,000 total salary)

    • Department with lowest headcount: Finance (1 employee)

    • High salary range (>80k): Meera & Karan

    • Medium salary range (50kโ€“80k): Majority employees

    • Low salary (<50k): None after updates

    1. Project Insights
    • Multiple high-performance projects: "ERP System", "E-Commerce", "Mobile App"

    • Most productive employee (hours): John

    • Ratings:

      • Excellent (>=8): 5 projects

      • Good (6โ€“7): 2 projects

    • Project distribution shows strong contribution from IT-related employees

    1. Managerial Structure
    • Managers:

      • Karan manages: Aisha & Riya

      • Meera manages: John & Sam

    • Trigger prevents deletion of managers to maintain hierarchy integrity


Category Questions
Basic Queries Q1โ€“Q7
Self Join Q9โ€“Q10
Window Functions Q11โ€“Q15
Aggregations Q16โ€“Q18
CTEs Q19โ€“Q20
Functions Q21โ€“Q22
Temporary Tables Q23โ€“Q24
Procedures Q25โ€“Q26
Triggers Q27โ€“Q28
Transactions Q29โ€“Q30
Views Q31โ€“Q32
Indexing Q33
Business Case Q35โ€“Q38

๐Ÿ“š Highlights of Important SQL Concepts Used

๐Ÿงฎ Window Functions

  • Ranking

  • Running totals

  • Avg salary difference

  • LAG & LEAD

๐Ÿ›  Procedures & Functions

  • Annual salary calculation

  • Experience in years

  • Insert project procedure

  • Transaction-safe employee + project insertion

๐Ÿ”’ Triggers

  • Logging deleted employees

  • Blocking deletion of managers

๐Ÿ‘ Views

  • Employee project details

  • IT employees with salary > 60k

โšก Indexing

  • Improving performance by indexing join or filter columns

๐Ÿง  Final Summary โ€“ What This Project Demonstrates

This SQL project proves your capability in:

  • โœ” Real-world database problem solving
  • โœ” Advanced SQL including transactions & triggers
  • โœ” Creating structured business insights from raw queries
  • โœ” Building production-level stored procedures & views
  • โœ” Data analysis using aggregate + window functions

๐Ÿ‘จโ€๐Ÿ’ป Author

Bhupendra Shivhare

Aspiring Data Scientist | Deep Learning Enthusiast

LinkedIn: www.linkedin.com/in/bhupendra-shivhare-a8a02a25b

๐Ÿ“ง Email: shivharebhupendra@gmail.com

About

A collection of SQL queries and insights analyzing employee and department data, showcasing aggregation, joins, window functions, and real-world business problem solving.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published