This repository contains datasets and problem statements for 66 popular SQL questions from LeetCode.
The goal is to practice solving SQL problems directly on Microsoft SQL Server using clean sample datasets.
leetcode-sql-practice/
β
βββ datasets/
β βββ leetcode_sql_practice_dataset.sql
β βββ README_DATASETS.md
β
βββ questions/
β βββ Easy/
β β βββ 175_combine_two_tables.md
β β βββ 176_second_highest_salary.md
β β βββ ... (easy questions)
β βββ Medium/
β β βββ 177_nth_highest_salary.md
β β βββ 534_game_play_analysis_iii.md
β β βββ ... (medium questions)
β βββ Hard/
β β βββ 1179_reformat_department_table.md
β β βββ 1212_team_scores_in_football_tournament.md
βββ Solutions/
β βββ Easy/
β β βββ 175_combine_two_tables.md
β β βββ 176_second_highest_salary.md
β β βββ ... (easy questions)
β βββ Medium/
β β βββ 177_nth_highest_salary.md
β β βββ 534_game_play_analysis_iii.md
β β βββ ... (medium questions)
β βββ Hard/
β β βββ 1179_reformat_department_table.md
β β βββ 1212_team_scores_in_football_tournament.md
βββ README.md
- Basic SQL queries
- Aggregations and Group By
- Joins
- Window functions (RANK, DENSE_RANK)
- CTEs (Common Table Expressions)
- Subqueries
- Data Transformation queries
- Advanced SQL Patterns
- Clone or download the repository.
- Open Microsoft SQL Server Management Studio (SSMS).
- Create a new database (e.g.,
Leetcode). - Load the full dataset :
USE Leetcode;
:r datasets/leetcode_sql_practice_dataset.sql