题解 | #获取有奖金的员工相关信息。#
对于employees表中,给出奇数行的first_name
http://www.nowcoder.com/practice/e3cf1171f6cc426bac85fd4ffa786594
select t1.first_name from employees as em inner join ( select rank() OVER(order by e.first_name asc) as first_n,first_name from employees as e ) as t1 on em.first_name = t1.first_name where mod(t1.first_n,2)<>0
为什么这个可以通过测试,而不连接的通不过呢?
可能兄弟们没有看到最后一句的,不要排序的,所以
我们将原表与奇数表连接,原表第一个是Georgi,而我们
排好序的是Anneke,所以第一次比对是不会相同的,等到比对到
Georgi才会输出