數(shù)據(jù)庫(kù)top語(yǔ)句 Sql語(yǔ)句的TOP用法?
Sql語(yǔ)句的TOP用法?select top 10 * from record --加 "top 10" 表示查詢的是數(shù)據(jù)表中的前十行數(shù)據(jù) select top 10 percen
Sql語(yǔ)句的TOP用法?
select top 10 * from record --加 "top 10" 表示查詢的是數(shù)據(jù)表中的前十行數(shù)據(jù) select top 10 percent * from record --加“top 10 percent”表示查詢的是數(shù)據(jù)表中前10%的數(shù)據(jù),若將10改為20,則查詢的就是前20%的數(shù)據(jù). declare @i int --聲明變量set @i=20 --給變量賦值select top (@i) percent * from record --查詢數(shù)據(jù)表中前20%的數(shù)據(jù).若后面不跟percent,則查詢的為前20行數(shù)據(jù).基本就是這幾種用法了,望采納....