This repository contains well-organized and optimized solutions for the Top 50 SQL Problems from the LeetCode SQL Study Plan. The solutions are categorized into folders based on specific topics, ensuring clarity and ease of navigation.
The repository is structured as follows:
├── 001 Select/
├── 002 Basic Joins/
├── 003 Basic Aggregate Functions/
├── 004 Sorting and Grouping/
├── 005 Advanced Select and Joins/
├── 006 Subqueries/
├── 007 Advanced String Functions, Regex, Clause/
├── LICENSE
└── README.md
Each folder contains .sql files corresponding to problems that focus on the respective topic.
The solutions in this repository cover a wide range of SQL concepts:
- Select Statements: Basic querying with
SELECTandWHEREclauses. - Joins: Understanding and applying
INNER JOIN,LEFT JOIN,RIGHT JOIN, andFULL OUTER JOIN. - Aggregate Functions: Utilizing
SUM,AVG,COUNT,MIN, andMAX. - Sorting and Grouping: Leveraging
GROUP BY,ORDER BY, andHAVINGfor data aggregation and sorting. - Advanced Queries: Complex joins, nested queries, and subqueries.
- String Functions and Regex: Manipulating text data using advanced SQL functions.
- Clauses: Implementing
CASE,LIMIT,OFFSET, and other advanced clauses.
-
Clone this repository:
git clone https://github.com/abhixsliet/leetcode-sql-50.git cd leetcode-sql-50 -
Navigate to the relevant folder for the topic you want to practice.
-
Open the
.sqlfiles in your preferred SQL environment (e.g., MySQL, PostgreSQL, SQL Server). -
Practice the problems alongside the LeetCode SQL Study Plan.
- Topic-based categorization for easy navigation and learning.
- Optimized solutions written for performance and clarity.
- Solutions include real-world problem-solving techniques to prepare for interviews.
Contributions are welcome! If you'd like to add new solutions or optimize existing ones, feel free to open an issue or submit a pull request.
This repository is licensed under the MIT License. You can use the code for personal and educational purposes.
- Thanks to LeetCode for providing these SQL problems.
- The SQL community for inspiring collaborative learning and improvement.
If this repository helps you, consider giving it a ⭐!
Happy coding! 😊