2019.9.26学习内容及小结
复习 ''' 1.单表查询 增删改查的完整语法 select distinct 字段 from 表 where group by having order by limit 比较: > < = 区间: between and | in | not in 逻辑: and or not 相似: like _% (一个 _ 代表 一个任意字符, % 代表不限制数量任意字符) 正则: regexp '.*[0-9]' 表示包含数字[0-9],用 not regexp '.*[0-9]' 就是不包含数字 聚合函数: group_concat()、max()、min()等;注:group_concat就是将字段合在一起,用于group by的拼接,用法和直接concat是一样的 也可以用于直接加上某条字段:group_concat(name) 名字, 来用于group by 后面没有字段的情况 having: 可以对 聚合函数 结果进行筛选,不能使用 聚合函数 别名 order by: 分组后对 聚合函数 进行排序,能使用 聚合函数 别名 limit: 条数 | 偏移量,条数 如limit(5,3), 过滤掉前五条数据,取出之后三条数据 2. 多表查询 内连接:from emp [inner] join dep on emp.dep_id = dep.id :只保留两表有对应关系的记录 左连接