SQL数据库数据检索top和distinct

一、distinct:针对查询的结果去去除重复(主要针对查询的结果)

  1. top获取前几条数据,top一般都与Order by连用(desc、asc)
  2. distinct去除重复的数据
  3. select distinct Sname from Student
  4. select top 5 * from Student order by tmath desc

二、查询前百分之30%,若不是整数比向上取整

 select top 35 percent * from tableScore order by desc



猜你喜欢

转载自blog.csdn.net/weixin_40184249/article/details/80700495
今日推荐