Sobes.tech
Middle

WYBIERZ * Z tabeli1 JAK t1 LEWY JOIN tabeli2 JAK t2 NA t1.date_start > t2.date_start --DML UTWÓRZ TABELĘ JEŚLI NIE ISTNIEJE Employee (id int, salary int, departmentId int); WSTAW DO Employee (id,salary,departmentId) WARTOŚCI (1, 70000, 1),(2, 94000, 1),(3, 85000, 1),(4, 80000, 2),(5, 60000, 2),(6, 62000, 3),(7, 90000, 3),(8, 94000, 3),(9, 94000, 3); z cte jako( wybierz *, rank() over(partition by departmentId order by salary desc) jako max_salary z Employee ) wybierz * z cte gdzie max_salary = 1