SQL server 数据库部分语法
use test ;
select * from student ;
select top 3 * from student ; 取123行
select top 3 * from student where id not in( select top 3 id from student );取456行
select * from (select top 3 id from student ) mm ;
select top 4 * from student where id not in(select top 3 id from student where id not in( select top 3 id from student )); 取1237 四行
本文深入探讨了SQL Server数据库中的高级查询技巧,包括如何使用TOP子句精确选取记录,以及通过嵌套子查询实现复杂的筛选逻辑。通过具体实例展示了如何避免数据冗余,高效获取所需数据行。
1万+

被折叠的 条评论
为什么被折叠?



