/leetcode-sql-problems

This repository contains solutions to various SQL problems from LeetCode, categorized by difficulty level (Easy, Medium, Hard). Each problem is provided with a SQL script demonstrating its solution.

MIT LicenseMIT

leetcode-sql-problems

This repository contains solutions to various SQL problems from LeetCode.

Easy Problems

  • [175: Combine Two Tables]
  • [181: Employees Earning More Than Their Managers]
  • [182: Duplicate Emails]
  • [183: Customers Who Never Order]
  • [196: Delete Duplicate Emails]
  • [197: Rising Temperature]
  • [577: Employee Bonus]
  • [584: Find Customer Referee]
  • [586: Customer Placing the Largest Number of Orders]
  • [595: Big Countries]
  • [596: Classes More Than 5 Students]
  • [607: Sales Person]
  • [610: Triangle Judgement]
  • [619: Biggest Single Number]
  • [620: Not Boring Movies]
  • [627: Swap Salary]
  • [1050: Actors and Directors Who Cooperated At Least Three Times]
  • [1068: Product Sales Analysis I]
  • [1075: Project Employees I]
  • [1141. User Activity for the Past 30 Days I]
  • [1148: Article Views I]
  • [1193: Monthly Transactions I]
  • [1211: Queries Quality and Percentage]
  • [1251: Average Selling Price]
  • [1280: Students and Examinations]
  • [1327: List the Products Ordered in a Period]
  • [1378: Replace Employee ID With The Unique Identifier]
  • [1517: Find Users With Valid E-Mails]
  • [1484: Group Sold Products By The Date]
  • [1527: Patients With a Condition]
  • [1581: Customer Who Visited but Did Not Make Any Transactions]
  • [1633: Percentage of Users Attended a Contest]
  • [1661: Average Time of Process per Machine]
  • [1667: Fix Names in a Table]
  • [1683: Invalid Tweets]
  • [1729: Find Followers Count]
  • [1731: The Number of Employees Which Report to Each Employee]
  • [1757: Recyclable and Low Fat Products]
  • [1789: Primary Department for Each Employee]
  • [1795: Rearrange Products Table]
  • [1978: Employees Whose Manager Left the Company]
  • [2356: Number of Unique Subjects Taught by Each Teacher]

Medium Problems

  • [176: Second Highest Salary]
  • [178: Rank Scores]
  • [180: Consecutive Numbers]
  • [184: Department Highest Salary]
  • [550: Game Play Analysis IV]
  • [570: Managers with at Least 5 Direct Reports]
  • [585: Investments in 2016]
  • [602: Friend Requests II: Who Has the Most Friends]
  • [608: Tree Node]
  • [626: Exchange Seats]
  • [1045: Customers Who Bought All Products]
  • [1070: Product Sales Analysis III]
  • [1164: Product Price at a Given Date]
  • [1174: Immediate Food Delivery II]
  • [1204: Last Person to Fit in the Bus]
  • [1907: Count Salary Categories]
  • [1934: Confirmation Rate]

Hard Problems

  • [262: Trips and Users]

Usage

To run these SQL scripts, copy the content of the .sql file and execute it in your SQL database environment.

Contributing

Feel free to submit pull requests to add more solutions or improve existing ones.