Skip to content

Abchoudhary2512/master-sql-100

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Top 100 SQL Practice Questions with Answers

A curated collection of 100 SQL Interview & Practice Questions ranging from Beginner → Advanced, including optimized solutions and real-world business scenarios.


About This Repository

This repository helps you:

  • Master SQL fundamentals
  • Prepare for technical interviews
  • Strengthen analytical thinking
  • Practice real-world business problems
  • Learn query optimization techniques

Difficulty Breakdown

Level Count Topics Covered
Easy 40 SELECT, WHERE, ORDER BY, GROUP BY, Aggregations
Medium 35 JOINs, Subqueries, CASE, CTEs
Hard 25 Window Functions, Recursive CTE, Advanced Analytics

Repository Structure

Top100-SQL-Practice/
│
├── Dataset/
│   ├── Data.txt
│   ├── DatabaseDesign.svg
│   └── SchemaDefinition.md
│
├── Easy/
│   ├── (1-15).md
│   ├── (16-30).md
│   └── (31-40).md
│
├── Medium/
│   ├── (41-55).md
│   ├── (56-65).md
│   └── (66-75).md
│
├── Hard/
│   ├── (76-90).md
│   └── (91-100).md
│
└── PracticeQuestions/
    └── Top100.md

Easy Level (40 Questions)

Focus Areas:

  • Basic SELECT queries
  • Filtering with WHERE
  • Sorting with ORDER BY
  • Aggregations (COUNT, SUM, AVG, MIN, MAX)
  • GROUP BY & HAVING

Skills Developed:

  • Data retrieval
  • Basic filtering
  • Simple reporting queries

Medium Level (35 Questions)

Focus Areas:

  • INNER JOIN, LEFT JOIN
  • Correlated & Non-correlated Subqueries
  • CASE statements
  • Common Table Expressions (CTEs)
  • Multi-table aggregations

Skills Developed:

  • Data relationships
  • Business logic implementation
  • Analytical reporting

Hard Level (25 Questions)

Focus Areas:

  • Window Functions (RANK, DENSE_RANK, ROW_NUMBER, LAG, LEAD)
  • Recursive CTE
  • Running totals & moving averages
  • Advanced aggregations
  • Revenue & growth analytics
  • Fraud detection patterns

Skills Developed:

  • Advanced analytics
  • Performance optimization thinking
  • Real-world business intelligence queries

Database Used

The questions are based on a realistic E-Commerce Database Schema, including:

  • Customers
  • Orders
  • Order_Items
  • Products
  • Categories
  • Payments
  • Addresses

How to Use This Repository

  1. Choose a difficulty level
  2. Solve the question independently
  3. Compare with the provided solution
  4. Review the explanation
  5. Try optimizing the query

💡 Pro Tip: Solve without looking at the answer first.


Final Goal

Become SQL confident.
Think in queries.
Solve problems like a Data Professional.


Important Note

Minor result differences may occur due to:

  • Date functions (e.g., CURDATE())
  • Rounding variations
  • SQL dialect differences (MySQL / PostgreSQL / SQL Server)
  • Changes in sample data

If you notice any issue, simply report the question number and the problem — I’ll fix it.


Happy Querying! 🚀

About

A curated collection of 100 SQL interview & practice questions ranging from beginner to advanced level , with solutions, explanations, and optimized approaches.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors