完整的增删查改 增语法 insert into顺序插入 insert 表名(.....)values(......)关键字插入 insert select 插入查询结果 删除语法 delete truncate 与前面没改变 改语法 update set无条件修改 update set where 条件修改,条件没找到就不做修改 查语法 select [distinct] 字段 [as别名] from 表名 约束条件 其中别名可以是中文 约束条件必须要按顺序排序 where->group by->having-> distinct->order by ->limit 简单查询 select concate(a,b) as s from 表; 常用函数 concat:拼接字段 concat_ws(x,字段):x是拼接符 lower()小写 upper()大写 ceil()xiang上去整 floor()向下取整 round()取整 distinct 去重前提:所有结果字段完全相同,才认为是重复的,只保留重复中的一行 where 条件运算符 比较运算符 区间运算符 where x between 3 and 5;闭合区间 where x in(2,3,45,6);分离区间 逻辑运算符 and|or|not 相似运算符 like '_iw%' 正则匹配 why:like 完成模糊匹配,但功能局限,刻意模糊个数,但不能模糊类型’‘ regexp'正则表达式’ 主意:支持部分正则语法 where name regexp '' group by 分组 max() min() avg() sum() count() group_concat() 子查询 in all any having 分组后需要用分组后的结果判断时用 注意:相同部分较多的进行分组 在非组模式下,可以进行查询,但是意义不大