查询

 

 

 

select 字段 from 数据表 where 条件 group by 分组依据 order by 排序依据;

  

1、select DISTINCT amount from checks; ———在checks表中查找不重复的amount

 2、select xx ||xx  新xx from xx 连接—可以将两个字符串串连接起来

3、select x from xx where xx like (not like) xx; 查询xx/不是xx

4、select A from xxA UNION select A from xxB;——-查询2个表中不重复的字段(去掉重复)

5、select A from xxA UNION ALL select A from xxB;—查询2个表中不重复的字段(不去掉重复)

6、INTERSECT 相交

INTERSECT 返回两个表中共有的⾏

select * from xxA intersect select * from xxB;

 

7、MINUS 相减

存在第一个表中,但不存在第二个表中

select * from xxA minus select * from xxB

 

8、从属运算 IN and BETWEEN 

SELECT * FROM FRIENDS WHERE STATE= 'CA' OR STATE ='CO' OR STATE = 'LA'       等价于  SELECT * FROM FRIENDS WHERE STATE IN('CA','CO','LA')

SELECT * FROM PRICE WHERE WHOLESLE>0.25 AND  WHOLESE <0.75; 等价于  SELECT * FROM PRICE WHERE WHOLESALE BETWEEN 0.25 AND 0.75