一开始是用窗口函数做的,但是怎么都做不对...
SELECT a.first_name FROM ( SELECT first_name, row_number()over(ORDER BY first_name)AS rank_num FROM employees )a WHERE a.rank_num%2 = 1;因为实在是无法理解COUNT的做法,看了大家的评论说是
- 题目中要求“输出的结果不需排序”……
SELECT e.first_name FROM employees e JOIN ( SELECT first_name , ROW_NUMBER() OVER(ORDER BY first_name ASC) AS r_num FROM employees ) AS t ON e.first_name = t.first_name WHERE t.r_num % 2 = 1;加上表连结就能通过了(这样结果就不排序了)