175. Combine Two Tables
select firstName, lastName, city, state
from person p
left join address a on p.personId = a.personId
178. Rank Scores
select score, (dense_rank() over (order by score desc)) as 'rank'
from scores
order by score desc
184. Department Highest Salary
select d.name as Department, e.name as Employee, salary as Salary
from Employee e, Department d
where e.departmentId = d.id and (e.departmentId, salary) in
(
select departmentId, max(salary) from Employee
group by DepartmentId
)
'Data > SQL' 카테고리의 다른 글
[solvesql] 다음날도 서울숲의 미세먼지 농도는 나쁨 😢 (0) | 2024.02.24 |
---|---|
[Leetcode] 1045. Customers Who Bought All Products (0) | 2024.01.19 |
[Leetcode] 1661. Average Time of Process per Machine (0) | 2024.01.09 |
[Leetcode] 602. Friend Requests II: Who Has the Most Friends (0) | 2024.01.09 |
[Leetcode] 1757. Recyclable and Low Fat Products (0) | 2024.01.08 |