2021. máj 28.

Leetcode 178: Rank scores: My Solution

írta: dataanalyticsdemo
Leetcode 178: Rank scores: My Solution

Free sample test question III.

with ranked as (select * ,dense_rank() over (order by score desc) as rn from scores) select score, rn as 'Rank'from ranked order by score desc

Tovább Szólj hozzá

2021. máj 28.

Leetcode 185: Department Top Three Salaries: My Solution

írta: dataanalyticsdemo
Leetcode 185: Department Top Three Salaries: My Solution

Free sample test question II.

with combined as (select E.*, D.name as dep_name from employee E left join department D on E.departmentid = d.id ), ranked as ( select * ,dense_rank() over (partition by dep_name order by salary desc) as rnfrom combined ) select dep_name as department, name as Employee, salary as Salary from…

Tovább Szólj hozzá

2021. máj 28.

Multiple tables in FROM

írta: dataanalyticsdemo
Multiple tables in FROM

Inspired by Leetcode "Consecutive numbers" question

Let's take this example table first: Results in simple 8 lines: When I use the same table 3 times in the FROM clause: 512 rows..But why? 8*8*8 = 512. So you need to narrow that combination down with the commented part: Now we have the same table, 3 times, without the weired…

Tovább Szólj hozzá

süti beállítások módosítása