-
Notifications
You must be signed in to change notification settings - Fork 0
Leetcode SQL 50 QNA
Praveen Kumar Anwla edited this page Feb 16, 2025
·
37 revisions
- https://leetcode.com/problems/rising-temperature/description/?envType=study-plan-v2&envId=top-sql-50 - A very good question to understand self-join by merging 2 tables on consecutive dates.
- https://leetcode.com/problems/managers-with-at-least-5-direct-reports/description/?envType=study-plan-v2&envId=top-sql-50 - A very good question to understand self-join in general.
- https://leetcode.com/problems/students-and-examinations/description/?envType=study-plan-v2&envId=top-sql-50 - Very good question to understand cross join effectively.
-
https://leetcode.com/problems/biggest-single-number/?envType=study-plan-v2&envId=top-sql-50 - Good question to understand the usage of IF to incorporate NULL conditions
-
https://leetcode.com/problems/second-highest-salary/description/?envType=study-plan-v2&envId=top-sql-50 -- Good question to understand the usage of IF to incorporate NULL conditions
-
https://leetcode.com/problems/immediate-food-delivery-ii/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/game-play-analysis-iv/?envType=study-plan-v2&envId=top-sql-50 - Extremely good question to learn to implement consecutive days.
- https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/description/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/employees-whose-manager-left-the-company/?envType=study-plan-v2&envId=top-sql-50 -- Good query to understand how to subset data within one table.
- https://leetcode.com/problems/confirmation-rate/description/?envType=study-plan-v2&envId=top-sql-50 :: 1. Very good to understand questions using categorical variables such as action: timeout, confirmed, etc. 2. Provides a glimpse of good usage of AVG function 3. Good to understand COALESCE to avoid division by zero.
- https://leetcode.com/problems/user-activity-for-the-past-30-days-i/submissions/1202517839/?envType=study-plan-v2&envId=top-sql-50 1. Very good to understand questions using categorical variables such as activity_type, etc, 2. learn to use IN inside CASE Block.
- https://leetcode.com/problems/monthly-transactions-i/?envType=study-plan-v2&envId=top-sql-50 -- Learn to utilize effectiveness of using "IF" block.
- https://leetcode.com/problems/triangle-judgement/?envType=study-plan-v2&envId=top-sql-50 -- Very good question Learn to utilize multiple conditions inside one single IF block.
- https://leetcode.com/problems/last-person-to-fit-in-the-bus/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/delete-duplicate-emails/?envType=study-plan-v2&envId=top-sql-50 --- Good question to practice DELETE function
- https://leetcode.com/problems/list-the-products-ordered-in-a-period/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/customers-who-bought-all-products/description/?envType=study-plan-v2&envId=top-sql-50 -- Good example to understand power of subquery in HAVING clause.
- https://leetcode.com/problems/count-salary-categories/?envType=study-plan-v2&envId=top-sql-50 -- Very good example to understand usage of backticks.
- https://leetcode.com/problems/product-price-at-a-given-date/?envType=study-plan-v2&envId=top-sql-50 -- Very good example to understand usage of UNION.
- https://leetcode.com/problems/user-activity-for-the-past-30-days-i/description/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/article-views-i/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/average-selling-price/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/percentage-of-users-attended-a-contest/?envType=study-plan-v2&envId=top-sql-50 -- Understand how to calculate %.
- https://leetcode.com/problems/invalid-tweets/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/find-followers-count/?envType=study-plan-v2&envId=top-sql-50*
- https://leetcode.com/problems/employee-bonus/?envType=study-plan-v2&envId=top-sql-50 -- Shows the importance of mentioning ISNULL in query.
- https://leetcode.com/problems/queries-quality-and-percentage/?envType=study-plan-v2&envId=top-sql-50 -- Good to understand effectiveness of using AVG function.
- https://leetcode.com/problems/restaurant-growth/?envType=study-plan-v2&envId=top-sql-50 -- Good to understand importance of group by in special cases.
- https://leetcode.com/problems/average-selling-price/?envType=study-plan-v2&envId=top-sql-50 -- Importance of putting condition in FROM clause.
- https://leetcode.com/problems/rising-temperature/description/?envType=study-plan-v2&envId=top-sql-50 - A very good question to understand self-join by merging 2 tables on consecutive dates.
- https://leetcode.com/problems/game-play-analysis-iv/?envType=study-plan-v2&envId=top-sql-50 - Extremely good question to learn to implement consecutive days.
- https://leetcode.com/problems/consecutive-numbers/description/?envType=study-plan-v2&envId=top-sql-50 - Very good question to learn usage of LEAD to calculate consecutive position of number.
- https://leetcode.com/problems/students-and-examinations/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/average-time-of-process-per-machine/?envType=study-plan-v2&envId=top-sql-50
- https://leetcode.com/problems/product-sales-analysis-iii/description/?envType=study-plan-v2&envId=top-sql-50
Note: Following repositories contain top 3 possible answers for above questions: Leetccode-50-QNA_comprehensive