自用题解
对于employees表中,给出奇数行的first_name
http://www.nowcoder.com/questionTerminal/e3cf1171f6cc426bac85fd4ffa786594
通过窗口函数生成一张新的表
select `emp_no` as `e_n`, `first_name`, row_number() over(order by `first_name` asc) as `r_num` from `employees`
然后与原表进行连接操作
select `e`.`first_name` from `employees` as `e` inner join ( select `emp_no` as `e_n`, `first_name`, row_number() over(order by `first_name` asc) as `r_num` from `employees` ) as `t` on `e`.`emp_no`=`t`.`e_n` where `t`.`r_num`%2=1