标签:重复 space sql面试题 style bsp 数据表 des 试题 span
1.根据emp数据表编写SQL查出所有name重复的记录且按照age降序。
+--------+--------+-----+
| emp_no | name | age |
+--------+--------+-----+
| 1001 | 小明 | 18 |
| 1002 | 王强 | 20 |
| 1003 | 小雪 | 20 |
| 1004 | 小明 | 19 |
+--------+--------+-----+
select emp_no, name,age from emp where name in ( select t.name from ( select name,count(name) as num from emp group by name having num > 1 )t ) order by age desc;
标签:重复 space sql面试题 style bsp 数据表 des 试题 span
原文地址:https://www.cnblogs.com/guchunchao/p/12622453.html