时间:2021-07-01 10:21:17 帮助过:24人阅读
数据查询-限制行数
//限制固定行数
SELECT TOP 5 SName, SAddress
FROM Students WHERE SSex = 0
//返回百分之多少行
SELECT TOP 20 PERCENT SName, SAddress
FROM Students WHERE SSex = 0
查询单列排序
//升序排列
SELECT StudentID AS 学生编号,(Score*0.9+5) AS 综合成绩
FROM Score
WHERE (Score*0.9+5)>60
ORDER BY Score
//降序排列
SELECT StudentID,Score FROM Score ORDER BY Score DESC
//按多列排序
SELECT StudentID AS 学生编号, CourseID AS 课程ID, Score AS 成绩
FROM Score
WHERE Score > 60
ORDER BY CourseID, Score
sqlserver数据库查询数据
标签:连接数 where 类型 限制行 sadd desc 连接 pos 查询