- sql语句除了字符串,大小写不敏感
- primary Key(key) 默认该属性为not null
- Create , Drop,Alter为DDL
- Insert , Update ,delete为DML
- select all/distinct(默认保留重复)
- 当运算(+-*/)在select时,只影响显示数值,不影响数据库中数据本身
- natural join和Where a.x=b.y的区别是,显示时属性列数不同
- 匹配字符串(关键词like)
- %匹配任意子串
- -匹配任意字符
- Inyto%任意以Inyto开始的字符串
- %ans%包含子串ans的
- --- 任意三个字符(刚好三个)
- ---%任意至少有三个字符的字符串
- 并union操作必须是属性个数以及名称都匹配的情况下才能使用,默认保留重复
- interest交集
- except默认不保留重复
- 大部分情况下,null可以看作是false,除了not unknow = unknow
- and
- true & unknow = unknow
- false & unknow = false
- unknow & unknow = unknow
- or
- true | unknow = true
- unknow | false =unknow
- unknow | unknow = unknow
- not
- unknow |unknow =unknow
- and
- 聚集函数(aggregate function)
- avg
- min
- max
- count (前面不能加distinct)(默认不计算空值)
- sum
- order by默认升序asc(降序为order by desc)
- group by
- 出现在select中并且不是在聚集函数中的属性要出现在group by子句中
- exists(存在(不为空集))常用于判断包含关系 X-Y = 空集 => X∈Y ,not exits(不存在(为空集))
- with子句(临时命名) p99