题解 | #对于employees表中,给出奇数行的first_name#

对于employees表中,给出奇数行的first_name

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

  • 问题:不理解为啥按照名连接,为啥不按主键连接,。。。。
  • 坑:不按照排序规则来输出结果
with t1 as(
select * ,
    ROW_NUMBER() over(order by first_name) as rank_1
from employees
)
SELECT e.first_name FROM employees as e
join t1 on  e.first_name =t1.first_name 
where rank_1 % 2 =1;
全部评论

相关推荐

牛油果甜奶昔:别的先不说,牛客还能内推护士?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务