LeetCode_Study_Plan
-
176. Second Highest Salary mysqlLeetCode_Study_Plan/SQL 2022. 10. 2. 14:00
https://leetcode.com/problems/second-highest-salary/?envType=study-plan&id=sql-i Second Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com SELECT IFNULL( (SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1 OFFSET 1), NULL) AS SecondHighestSalary; offset..
-
608. Tree Node mysqlLeetCode_Study_Plan/SQL 2022. 10. 2. 13:45
https://leetcode.com/problems/tree-node/?envType=study-plan&id=sql-i Tree Node - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 처음에는 삼항연산자를 동원해서 풀어보고 그랬는데 case when then else end를 이용하면 훨씬 깔끔하게 풀 수 있다. 게다가 당연히 inner join을 한다고 생각했는데 그렇게 풀지 않아도 되었다. SELECT id, CASE WHEN p_id IS NULL ..
-
607. Sales Person mysqlLeetCode_Study_Plan/SQL 2022. 9. 30. 16:28
https://leetcode.com/problems/sales-person/?envType=study-plan&id=sql-i Sales Person - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com select name from salesPerson where name not in (select s.name from salesperson s left join (select c.com_id, c.name, o.sales_id from company c left..
-
197. Rising Temperature mysqlLeetCode_Study_Plan/SQL 2022. 9. 30. 16:12
https://leetcode.com/problems/rising-temperature/?envType=study-plan&id=sql-i Rising Temperature - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com lag, lead 이런거 찾아보고 있었는데 self join의 on으로 처리해서 풀 수 있었다.. 어렵네.. select A.id as id from weather a inner join weather b on datediff(a.record..
-
1148. Article Views I mysqlLeetCode_Study_Plan/SQL 2022. 9. 30. 14:57
https://leetcode.com/problems/article-views-i/?envType=study-plan&id=sql-i Article Views I - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com select distinct author_id as id from views where author_id = viewer_id order by author_id;
-
1581. Customer Who Visited but Did Not Make Any Transactions mysqlLeetCode_Study_Plan/SQL 2022. 9. 30. 14:54
https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions select v.customer_id, count(*) as count_no_trans from visits v left join transactions t on v.visit_id = t.visit_id where t.transaction_id is null group by v.customer_id;
-
1795. Rearrange Products Table mysqlLeetCode_Study_Plan/SQL 2022. 9. 29. 18:09
https://leetcode.com/problems/rearrange-products-table Rearrange Products Table - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com select p1.product_id, 'store1' as store, store1 as price from (SELECT product_id, store1 FROM Products) p1 where store1 is not null union select p2.prod..