一、用T-SQL查询表中第n行到第m行数据的写法示例 假设这里的n=6,m=10则有以下两种写法,qusID可以不连续,如下: select top 5 * from tb_wenti where qusID not in(select top 5 qusID from tb_wenti); select top 5 * from tb_wenti where qusID in(selec
一、用t-sql查询表中第n行到第m行数据的写法示例
假设这里的n=6,,m=10则有以下两种写法,qusID可以不连续,如下:
select top 5 * from tb_wenti where qusID not in(select top 5 qusID from tb_wenti);
select top 5 * from tb_wenti where qusID in(select top 10 qusID from tb_wenti) order by qusID desc;
一般的写法为
select top m-n+1 * from tablename where id not in(select top n-1 id from tablename);
select top m-n+1 * from tablename where id in(select top m id from tablename) order by id desc;
二、从学生表(Student)里分别统计男生人数和女生人数(用一条SQL语句)
select distinct (select count(*) from Student where 性别='男') 男生数,(select count(*) from Student where 性别='女') 女生数 from Student;
其结果如图

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号