공부하는삶/SQL

https://leetcode.com/problems/department-highest-salary/ Department 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 DENSE RANK() 를 사용하여 출력하기 우선 DENSE RANK()와 RANK()의 차이점 output을 기준으로 보면, 다음과 같이 Salay가 내림차순으로 정렬이 되어 있다. - RANK() 함수 : Max 1위, Randy와 Joe 2위, 그리고 Will ..
https://leetcode.com/problems/department-highest-salary/ Department 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 Top.Name AS Department, E1.Name AS Employee, E1.Salary FROM Employee AS E1 INNER JOIN (SELECT D.Name, E.DepartmentId, MAX(Salary) AS S..
https://leetcode.com/problems/consecutive-numbers/ Consecutive Numbers - 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 Input : Table Logs Output : 처음 쿼리 : SELECT L1.Num AS ConsecutiveNums FROM Logs AS L1 INNER JOIN Logs AS L2 ON L1.Id+1 = L2.id INNER JOIN Logs AS L3 ON L1.Id + 2 ..
The Report - BETWEEN 범위 조건으로 JOIN 하기 report NOT : Names of those students who received a grade lower than 8. → if the grade is lower than 8, use "NULL" Ordering by grade in descending, than alphabetically More than one student with the same grade (1-7), ordering by marks in ascending order SELECT CASE WHEN G.grade >= 8 THEN S.Name ELSE NULL END AS Name, G.grade, S.Marks FROM Students S, Grades G..
Hanna 한나
'공부하는삶/SQL' 카테고리의 글 목록