题解 | #对于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;