提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
1
select b.name as department, a.name as employee, max(a.salary) as salary
from Employee a
join Department b
on a.departmentid = b.id
2
select (case
when mod(id,2)=1 and id =(select count(*) from seat) then id
when mod(id,2)= 0 then id-1
else id+1
end) as id,student from seat
order by id;
3
select score, dense_rank()over(order by score) as rank
from scores
4
SELECT DISTINCT(Num) AS Num
FROM (SELECT Num,id,lag(id,2) OVER(partition by num order by id) AS id_new FROM logs) A
WHERE A.id = A.id_new + 2