题解 | #给出employees表中排名为奇数行的first_name#
给出employees表中排名为奇数行的first_name
http://www.nowcoder.com/practice/e3cf1171f6cc426bac85fd4ffa786594
这题的关键在于找出排名为奇数。
排名数也是小于当前first_name的记录数.
排名数为奇数就是它除以2余1.
select first_name
from employees a
where
(select count(*)
from employees b
where a.first_name>=b.first_name)%2 = 1;
from employees a
where
(select count(*)
from employees b
where a.first_name>=b.first_name)%2 = 1;