|
4 | 4 | Solutions for all free SQL challenges on Leetcode executed on MySQL and MS SQL Server.
|
5 | 5 |
|
6 | 6 | ## Questions
|
| 7 | +### Easy |
7 | 8 | | Number| Challenges | Solutions|
|
8 | 9 | | :---:| --- | :---: |
|
9 | 10 | | 1 | [175. Combine Two Tables](https://leetcode.com/problems/combine-two-tables/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/175.Combine-Two-Tables.sql) |
|
10 | 11 | | 2 | [176. Second Highest Salary](https://leetcode.com/problems/second-highest-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/176.Second-Highest-Salary.sql) |
|
11 |
| -| 3 | [177. Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/177.Nth-Highest-Salary.sql) | |
12 |
| -| 4 | [178. Rank Scores](https://leetcode.com/problems/rank-scores/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/178.Rank-Scores.sql) | |
13 |
| -| 5 | [180. Consecutive Numbers](https://leetcode.com/problems/consecutive-numbers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/180.Consecutive-Numbers.sql) | |
14 |
| -| 6 | [181. Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/181.Employees-Earning-More-Than-Their-Managers.sql) | |
15 |
| -| 7 | [182. Duplicate Emails](https://leetcode.com/problems/duplicate-emails/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/182.Duplicate-Emails.sql) | |
16 |
| -| 8 | [183. Customers Who Never Order](https://leetcode.com/problems/customers-who-never-order/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/183.Customers-Who-Never-Order.sql) | |
17 |
| -| 9 | [184. Department Highest Salary](https://leetcode.com/problems/department-highest-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/184.Department-Highest-Salary.sql)| |
18 |
| -| 10 | [185. Department Top Three Salaries](https://leetcode.com/problems/department-top-three-salaries/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/185.Department-Top-Three-Salaries.sql)| |
19 |
| -| 11 | [196. Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails/)| [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/196.Delete-Duplicate-Emails.sql) | |
20 |
| -| 12 | [197. Rising Temperature](https://leetcode.com/problems/rising-temperature/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/197.Rising-Temperature.sql) | |
21 |
| -| 13 | [262. Trips and Users](https://leetcode.com/problems/trips-and-users/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/262.Trips-and-Users.sql) | |
22 |
| -| 14 | [511. Game Play Analysis I](https://leetcode.com/problems/game-play-analysis-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/511.%20Game-Play-Analysis-I.sql) | |
23 |
| -| 15 | [584. Find Customer Referee](https://leetcode.com/problems/find-customer-referee/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/584.Find-Customer-Referee.sql) | |
24 |
| -| 16 | [586. Customer Placing the Largest Number of Orders](https://leetcode.com/problems/customer-placing-the-largest-number-of-orders/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/586.Customer-Placing-the-Largest-Number-of-Orders.sql) | |
25 |
| -| 17 | [595. Big Countries](https://leetcode.com/problems/big-countries/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/595.Big-Countries.sql) | |
26 |
| -| 18 | [596. Classes More Than 5 Students](https://leetcode.com/problems/classes-more-than-5-students/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/596.Classes-More-Than-5-Students.sql) | |
27 |
| -| 19 | [601. Human Traffic of Stadium](https://leetcode.com/problems/human-traffic-of-stadium/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/601.Human-Traffic-of-Stadium.sql) | |
28 |
| -| 20 | [607. Sales Person](https://leetcode.com/problems/sales-person/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/607.Sales-Person.sql) | |
29 |
| -| 21 | [608. Tree Node](https://leetcode.com/problems/tree-node/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/608.Tree-Node.sql) | |
30 |
| -| 22 | [620. Not Boring Movies](https://leetcode.com/problems/not-boring-movies/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/620.Not-Boring-Movies.sql) | |
31 |
| -| 23 | [626. Exchange Seats](https://leetcode.com/problems/exchange-seats/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/626.Exchanges-Seats.sql) | |
32 |
| -| 24 | [627. Swap Salary](https://leetcode.com/problems/swap-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/627.Swap-Salary.sql) | |
33 |
| -| 25 | [1050. Actors and Directors Who Cooperated At Least Three Times](https://leetcode.com/problems/actors-and-directors-who-cooperated-at-least-three-times/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1050.Actors-and-Directors-Who-Cooperated-At-Least-Three-Times.sql)| |
34 |
| -| 26 | [1084. Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1084.Sales-Analysis-III.sql) | |
35 |
| -| 27 | [1141. User Activity for the Past 30 Days I](https://leetcode.com/problems/user-activity-for-the-past-30-days-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1141.User-Activity-for-the-Past-30-Days-I.sql) | |
36 |
| -| 28 | [1148. Article Views I](https://leetcode.com/problems/article-views-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1148.Article-Views-I.sql)| |
37 |
| -| 29 | [1158. Market Analysis I](https://leetcode.com/problems/market-analysis-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/1158.Market-Analysis-I.sql) | |
38 |
| -| 30 | [1179. Reformat Department Table](https://leetcode.com/problems/reformat-department-table/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1179.Reformat-Department-Table.sql) | |
39 |
| -| 31 | [1393. Capital Gain/Loss](https://leetcode.com/problems/capital-gainloss/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/1393.Capital-Gain-Loss.sql) | |
40 |
| -| 32 | [1407. Top Travellers](https://leetcode.com/problems/top-travellers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1407.Top-Travellers.sql) | |
41 |
| -| 33 | [1484. Group Sold Products By The Date](https://leetcode.com/problems/group-sold-products-by-the-date/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1484.Group-Sold-Products-By-The-Date.sql) | |
42 |
| -| 34 | [1527. Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1527.Patients-With-a-Condition.sql) | |
43 |
| -| 35 | [1581. Customer Who Visited but Did Not Make Any Transactions](https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1581.Customer-Who-Visited-but-Did-Not-Make-Any-Transactions.sql) | |
44 |
| -| 36 | [1587. Bank Account Summary II](https://leetcode.com/problems/bank-account-summary-ii/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1587.Bank-Account-Summary-II.sql) | |
45 |
| -| 37 | [Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table/) | [Link] | |
46 |
| -| 38 | [Daily Leads and Partners](https://leetcode.com/problems/daily-leads-and-partners/) | [Link] | |
47 |
| -| 39 | [Find Followers Count](https://leetcode.com/problems/find-followers-count/) | [Link] | |
48 |
| -| 40 | [Find Total Time Spent by Each Employee](https://leetcode.com/problems/find-total-time-spent-by-each-employee/) | [Link] | |
49 |
| -| 41 | [Recyclable and Low Fat Products](https://leetcode.com/problems/recyclable-and-low-fat-products/) | [Link] | |
50 |
| -| 42 | [Rearrange Products Table](https://leetcode.com/problems/rearrange-products-table/) | [Link] | |
51 |
| -| 43 | [Calculate Special Bonus](https://leetcode.com/problems/calculate-special-bonus/) | [Link] | |
52 |
| -| 44 | [The Latest Login in 2020](https://leetcode.com/problems/the-latest-login-in-2020/) | [Link] | |
53 |
| -| 45 | [Employees With Missing Information](https://leetcode.com/problems/employees-with-missing-information/) | [Link] | |
| 12 | +| 3 | [181. Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/181.Employees-Earning-More-Than-Their-Managers.sql) | |
| 13 | +| 4 | [182. Duplicate Emails](https://leetcode.com/problems/duplicate-emails/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/182.Duplicate-Emails.sql) | |
| 14 | +| 5 | [183. Customers Who Never Order](https://leetcode.com/problems/customers-who-never-order/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/183.Customers-Who-Never-Order.sql) | |
| 15 | +| 6 | [196. Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails/)| [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/196.Delete-Duplicate-Emails.sql) | |
| 16 | +| 7 | [197. Rising Temperature](https://leetcode.com/problems/rising-temperature/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/197.Rising-Temperature.sql) | |
| 17 | +| 8 | [511. Game Play Analysis I](https://leetcode.com/problems/game-play-analysis-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/511.%20Game-Play-Analysis-I.sql) | |
| 18 | +| 9 | [584. Find Customer Referee](https://leetcode.com/problems/find-customer-referee/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/584.Find-Customer-Referee.sql) | |
| 19 | +| 10 | [586. Customer Placing the Largest Number of Orders](https://leetcode.com/problems/customer-placing-the-largest-number-of-orders/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/586.Customer-Placing-the-Largest-Number-of-Orders.sql) | |
| 20 | +| 11 | [595. Big Countries](https://leetcode.com/problems/big-countries/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/595.Big-Countries.sql) | |
| 21 | +| 12 | [596. Classes More Than 5 Students](https://leetcode.com/problems/classes-more-than-5-students/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/596.Classes-More-Than-5-Students.sql) | |
| 22 | +| 13 | [607. Sales Person](https://leetcode.com/problems/sales-person/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/607.Sales-Person.sql) | |
| 23 | +| 14 | [620. Not Boring Movies](https://leetcode.com/problems/not-boring-movies/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/620.Not-Boring-Movies.sql) | |
| 24 | +| 15 | [627. Swap Salary](https://leetcode.com/problems/swap-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/627.Swap-Salary.sql) | |
| 25 | +| 16 | [1050. Actors and Directors Who Cooperated At Least Three Times](https://leetcode.com/problems/actors-and-directors-who-cooperated-at-least-three-times/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1050.Actors-and-Directors-Who-Cooperated-At-Least-Three-Times.sql)| |
| 26 | +| 17 | [1084. Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1084.Sales-Analysis-III.sql) | |
| 27 | +| 18 | [1141. User Activity for the Past 30 Days I](https://leetcode.com/problems/user-activity-for-the-past-30-days-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1141.User-Activity-for-the-Past-30-Days-I.sql) | |
| 28 | +| 19 | [1148. Article Views I](https://leetcode.com/problems/article-views-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1148.Article-Views-I.sql)| |
| 29 | +| 20 | [1179. Reformat Department Table](https://leetcode.com/problems/reformat-department-table/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1179.Reformat-Department-Table.sql) | |
| 30 | +| 21 | [1407. Top Travellers](https://leetcode.com/problems/top-travellers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1407.Top-Travellers.sql) | |
| 31 | +| 22 | [1484. Group Sold Products By The Date](https://leetcode.com/problems/group-sold-products-by-the-date/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1484.Group-Sold-Products-By-The-Date.sql) | |
| 32 | +| 23 | [1527. Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1527.Patients-With-a-Condition.sql) | |
| 33 | +| 24 | [1581. Customer Who Visited but Did Not Make Any Transactions](https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1581.Customer-Who-Visited-but-Did-Not-Make-Any-Transactions.sql) | |
| 34 | +| 25 | [1587. Bank Account Summary II](https://leetcode.com/problems/bank-account-summary-ii/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Easy/1587.Bank-Account-Summary-II.sql) | |
| 35 | +| 26 | [Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table/) | [Link] | |
| 36 | +| 27 | [Daily Leads and Partners](https://leetcode.com/problems/daily-leads-and-partners/) | [Link] | |
| 37 | +| 28 | [Find Followers Count](https://leetcode.com/problems/find-followers-count/) | [Link] | |
| 38 | +| 29 | [Find Total Time Spent by Each Employee](https://leetcode.com/problems/find-total-time-spent-by-each-employee/) | [Link] | |
| 39 | +| 30 | [Recyclable and Low Fat Products](https://leetcode.com/problems/recyclable-and-low-fat-products/) | [Link] | |
| 40 | +| 31 | [Rearrange Products Table](https://leetcode.com/problems/rearrange-products-table/) | [Link] | |
| 41 | +| 32 | [Calculate Special Bonus](https://leetcode.com/problems/calculate-special-bonus/) | [Link] | |
| 42 | +| 33 | [The Latest Login in 2020](https://leetcode.com/problems/the-latest-login-in-2020/) | [Link] | |
| 43 | +| 34 | [Employees With Missing Information](https://leetcode.com/problems/employees-with-missing-information/) | [Link] | |
| 44 | + |
| 45 | +### Medium |
| 46 | +| Number| Challenges | Solutions| |
| 47 | +| :---:| --- | :---: | |
| 48 | +| 1 | [177. Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/177.Nth-Highest-Salary.sql) | |
| 49 | +| 2 | [178. Rank Scores](https://leetcode.com/problems/rank-scores/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/178.Rank-Scores.sql) | |
| 50 | +| 3 | [180. Consecutive Numbers](https://leetcode.com/problems/consecutive-numbers/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/180.Consecutive-Numbers.sql) | |
| 51 | +| 4 | [184. Department Highest Salary](https://leetcode.com/problems/department-highest-salary/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/184.Department-Highest-Salary.sql)| |
| 52 | +| 5 | [608. Tree Node](https://leetcode.com/problems/tree-node/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/608.Tree-Node.sql) | |
| 53 | +| 6 | [626. Exchange Seats](https://leetcode.com/problems/exchange-seats/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/626.Exchanges-Seats.sql) | |
| 54 | +| 7 | [1158. Market Analysis I](https://leetcode.com/problems/market-analysis-i/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/1158.Market-Analysis-I.sql) | |
| 55 | +| 8 | [1393. Capital Gain/Loss](https://leetcode.com/problems/capital-gainloss/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Medium/1393.Capital-Gain-Loss.sql) | |
| 56 | + |
| 57 | +### Hard |
| 58 | +| Number| Challenges | Solutions| |
| 59 | +| :---:| --- | :---: | |
| 60 | +| 1 | [185. Department Top Three Salaries](https://leetcode.com/problems/department-top-three-salaries/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/185.Department-Top-Three-Salaries.sql)| |
| 61 | +| 2 | [262. Trips and Users](https://leetcode.com/problems/trips-and-users/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/262.Trips-and-Users.sql) | |
| 62 | +| 3 | [601. Human Traffic of Stadium](https://leetcode.com/problems/human-traffic-of-stadium/) | [Link](https://github.com/qanhnn12/SQL-Leetcode-Challenge-Solutions/blob/main/Hard/601.Human-Traffic-of-Stadium.sql) | |
0 commit comments