简单的查询

  1. 查询全部的行和列。

Select * from 表名

  1. 查询部分的行和列。

Select 列名1,列名2….. from 表名 where 条件。

  1. 在查询中使用列名的别名。

① 使用AS 字句来改变结果中列的名种。

Select user as 用户名 from 表名

② 使用=’来改变结果中列的名种。

Select user=’用户名’ from 表名

③ 使用’空格’来改变结果中列的名种。

Select user 用户名 from 表名

  1. is null 和 ‘’ 的不同之处。

is null 原始没有录入的数据,从未录过的数据

‘’录入过数据被删除是有数据的

  1. 查询返回限制的行数。

TOP 关键字

①  select top 个数 列名(或*from 表名

TOP 百分比数 percent

②  select top 百分比数 percent 列名(或*from 表名。

  1. 排序查询

order by 排序

asc:升序

desc:降序

select *from 表名(可以加whereorder by (升序还是降序)

列:select user from book where name=‘忠民’)order by user(这里的user是你要排序的列名) asc

posted @ 2018-03-30 11:02  WhiteSpace  阅读(141)  评论(0编辑  收藏  举报