首页 > 其他 > 详细

第四章 数据查询(上)

时间:2020-01-01 19:33:39      阅读:71      评论:0      收藏:0      [点我收藏+]

查询语句:

select <列名> 

from <表名>

[where <查询条件表达式>]

[ order by <排序的列名>[asc或desc] ]

  asc升序(缺省)  

  desc降序

使用as来命名列(取别名)

select Scode as 学员编号, Sname as 学员姓名, Saddress as 学员地址

from students

where Saddress<>‘河南新乡’

 

select FirstName + ‘.‘ + LastName AS ‘姓名‘ from Employees

 

 

查询空行

select SName from students where Semail IS NULL

 

查询非空行

select sname from students where not semail is null

或

select sname from students where semail is  not   null

 

限制固定行数

select top 5 sname, saddress 

from students where ssex = 0

 

返回百分之多少行

select top 20 percent sname, saddress 

from students where ssex = 0

 

 

 

 

第四章 数据查询(上)

原文:https://www.cnblogs.com/ftyl/p/12129374.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!