1、like子句
[where clause like '%com']
- '%'
- '_'
2、正则
3、union操作符
用于连接多个select语句,[distinct]删除重复数据
select col1, ......, coln from tbl_name
[where clause]
union [all(默认) / distinct]
select col1, ......, coln from tbl_name
[where clause]
4、order by 排序
select col1, ......, coln from tbl_name
[where clause]
order by col1,...... [ASC(默认) / DESC]
- gbk(汉字编码字符集)
- utf-8(万国码):order by convert (col1, ...... using gbk) [ASC(默认) / DESC]
5、group by 分组语句
select col1, ......, function(coln) from tbl_name
[where clause]
[group by col1]
[having clause]
[order by ......]
6、join 内连接
- left jpin
- join 或 inner join
- right join
以下两句等价:
(1)select tbl1.col1, tbl1.col2, tbl2.col3
from tbl_name1 tbl1 join tbl_name2 tbl2 on tbl1.col3 = tbl2.col3
(2)select tbl1.col1, tbl1.col2, tbl2.col3 from tbl_name1 tbl1, tbl_name2 tbl2
where tbl1.col3 = tbl2.col3