1.5 select编写

1、with:用于指定临时命名的结果

2、select A from B   在B中查看A

3、into 插入语句  例如:select A、B into 表1 from 表2

4、where 指定搜索条件

(1)逻辑运算符(and、not、or)

(2)比较运算符(常规)

(3)like:匹配关键词    

%匹配多个字符

_匹配一个字符

[ ] 指定范围

[^ ]  不属于指定范围

(4)between  A B and C      A中大于B且小于C的数

(5)is(not) null     对空值进行查询

(6)in   指定列表搜索条件,确定指定的值是否与子查询或者列表中的值相匹配

例如:select  * from table where id in(1,2,3)

(7)all:比较标量值和单列集中的值

some/any :大于最小值

(8)exists   确定行是否存在

5、group by:按一个或多个列表达式的值选定行组成一个新的集合

6、having:指定或聚合的搜索条件,在group by后面使用。

7、指定排序顺序:asc\desc

8、distinct 去掉重复记录   

9、top  显示指定行

猜你喜欢

转载自www.cnblogs.com/chuang0104/p/9028587.html
1.5