书写顺序
select distinct * from '表名' where '限制条件' group by '分组依据' having '过滤条件' order by limit '展示条数'
执行顺序
1.from(查询)
2.where(条件)
3.group by(分组)
4.having(过滤)
5.order by(排序)
6.limit(分页,显示记录数)
7.distinct(去重)
8.select(查询结果)
正则:select * from emp where name regexp '^j.*(n|y)$';
集合查询:max(最大) 、min(最小) 、avg(平均) 、sum(合计) 、count(个数) 、group_concat(拼接) 。
内连接:inner join
左连接:left join
右连接:right join
全连接: 左连接 union 右连接
replace 替换
拼接:concat,concat_ws,group_concat
mysql常用关键字及顺序
最新推荐文章于 2024-08-16 13:17:50 发布