This repository contains my solutions to the 50 SQL problems on LeetCode. I aim to solve one problem per day and add my solutions here. The goal of this project is to practice and improve my SQL skills, focusing on various types of SQL queries, optimization techniques, and solving real-world database challenges.
The SQL-50 LeetCode Solutions repository is a collection of SQL queries and their solutions to the 50 SQL problems on LeetCode. The repository is intended to help developers improve their SQL problem-solving skills by practicing with real-world examples.
As of today, I have solved the following problems:
- Recyclable and Low Fat Products
- Find Customer Referee
- Big Countries
- Article Views I
- Invalid Tweets
- Replace Employee ID With The Unique Identifier
- Product Sales Analysis I
- Customer Who Visited but Did Not Make Any Transactions
- Rising Temperature
- Average Time of Process per Machine
- 577. Employee Bonus
- 1280. Students and Examinations
- 570. Managers with at Least 5 Direct Reports
- 1934. Confirmation Rate
- 620. Not Boring Movies
- 1251. Average Selling Price
- 1075. Project Employees I
- 1633. Percentage of Users Attended a Contest
- 1211. Queries Quality and Percentage
- 1193. Monthly Transactions I
- 1174. Immediate Food Delivery II
- 550. Game Play Analysis IV
- 2356. Number of Unique Subjects Taught by Each Teacher
- 1141. User Activity for the Past 30 Days I
- 1070. Product Sales Analysis III
- 596. Classes More Than 5 Students
- 1729. Find Followers Count
- 619. Biggest Single Number
- 1045. Customers Who Bought All Products
- 1731. The Number of Employees Which Report to Each Employee
- 1789. Primary Department for Each Employee
- 610. Triangle Judgement
- 180. Consecutive Numbers
- 1164. Product Price at a Given Date
- 1204. Last Person to Fit in the Bus
- 1907. Count Salary Categories
- 1978. Employees Whose Manager Left the Company
- 626. Exchange Seats
- 1341. Movie Rating
- 1321. Restaurant Growth
- 602. Friend Requests II: Who Has the Most Friends
- 585. Investments in 2016
- 185. Department Top Three Salaries
- 1667. Fix Names in a Table
- 1527. Patients With a Condition
- 196. Delete Duplicate Emails
- 176. Second Highest Salary
- 1484. Group Sold Products By The Date(Current)
I will continue to add solutions daily.
-
Clone the repository to your local machine:
git clone https://github.com/mennaabdelelhady/SQL-50.git
-
Navigate to the project directory:
cd SQL-50
-
Browse through the individual solutions, which are named according to the problem number.
You can test the SQL queries using your preferred SQL platform (e.g., MySQL, PostgreSQL, SQLite).
Feel free to fork the repository, submit issues, or open pull requests with additional SQL solutions or improvements to existing ones. Here are some ways you can contribute:
- Solve additional SQL problems and submit a pull request.
- Help improve the performance or readability of existing solutions.
- Suggest new features or optimization techniques.
This repository is open-source and available under the MIT License.
SQL
LeetCode
Database
Query Optimization