题解 | #给出表中排名为奇数行的first_name#

给出employees表中排名为奇数行的first_name

https://www.nowcoder.com/practice/e3cf1171f6cc426bac85fd4ffa786594

select em.first_name
from employees em join (select emp_no, first_name, rank()over(order by first_name) rk from employees) as a on em.first_name = a.first_name
where rk % 2 =1

表连接中一定要选择first_name作为链接键,而不能使用表主键,但是不明白背后原理是什么,求大佬求解

全部评论

相关推荐

头像
05-13 11:19
C++
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务