查询比张三年龄大的所有同学的姓名,按年龄降序排序
发布网友
发布时间:2024-05-30 04:00
我来回答
共1个回答
热心网友
时间:2024-06-04 08:18
select stu_name from students
where stu_age > (select stu_age from students where stu_name = '张三')
order by stu_Age desc;
这种写法有个前提,没有重名的...
还可以这样
select s1.stu_name from students s1
where exists(select 1 from students s2 where s2.stu_name='张三' and s1.stu_age > s2.stu_age)
order by s1.stu_age desc;