This repository contains solutions for the Top 50 SQL Questions from LeetCode's SQL 50 Study Plan. It is designed to help you build and strengthen your SQL skills through real coding problems.
💡 Ideal for mastering SQL concepts such as
JOIN,GROUP BY,WINDOW FUNCTIONS,SUBQUERIES, and more.
Each folder is named using the LeetCode problem number and title (e.g., 1135-customers-who-bought-all-products). Inside each folder, you’ll find:
solution.sql– Contains the SQL query solving the problem.- (Optional) Comments explaining logic or approach.
- Basic
SELECTstatements JOIN(INNER, LEFT, RIGHT)GROUP BYandHAVING- Aggregate functions:
COUNT,SUM,AVG, etc. - Subqueries
UNION- Window functions:
RANK(),DENSE_RANK(),ROW_NUMBER() - Common Table Expressions (CTEs)