# MySQL 入门教程

## MySQL 入门教程

- [教程目录](https://hezhiqiang-book.gitbook.io/mysql/master.md)
- [第一章 基础教程](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang.md)
- [第一节 入门](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index.md)
- [1.1 安装](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index/an-zhuang.md)
- [1.2 示例数据库](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index/shi-li-shu-ju-ku.md)
- [第二节 查询数据](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-1.md)
- [2.1 SELECT 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-1/select-yu-ju.md)
- [2.2 SELECT DISTINCT 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-1/select-distinct-yu-ju.md)
- [第三节 过滤数据](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2.md)
- [3.1 WHERE 子句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/where-zi-ju.md)
- [3.2 AND 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/and-yun-suan-fu.md)
- [3.3 OR 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/or-yun-suan-fu.md)
- [3.4 IN 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/in-yun-suan-fu.md)
- [3.5 BETWEEN 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/between-yun-suan-fu.md)
- [3.6 LIKE 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/like-yun-suan-fu.md)
- [3.7 LIMIT 子句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/limit-zi-ju.md)
- [3.8 IS NULL 运算符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-2/is-null-yun-suan-fu.md)
- [第四节 数据排序](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-3.md)
- [4.1 ORDER BY 子句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-3/order-by-zi-ju.md)
- [4.1 自然排序](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-3/zi-ran-pai-xu.md)
- [第五节 连接表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4.md)
- [5.1 别名](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4/bie-ming.md)
- [5.2 INNER JOIN](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4/inner-join.md)
- [5.3 LEFT JOIN](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4/left-join.md)
- [5.4 自连接](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4/zi-lian-jie.md)
- [5.5 CROSS JOIN](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-4/cross-join.md)
- [第六节 分组数据](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-5.md)
- [6.1 GROUP BY子句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-5/group-by-zi-ju.md)
- [6.2 HAVING 子句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-5/having-zi-ju.md)
- [第七节 子查询，派生表和通用表达式](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-6.md)
- [7.1 子查询](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-6/zi-cha-xun.md)
- [7.2 派生表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-6/pai-sheng-biao.md)
- [7.3 公共表表达式](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-6/gong-gong-biao-biao-da-shi.md)
- [7.4 递归 CTE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-6/di-gui-cte.md)
- [第八节 集合操作符](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-7.md)
- [8.1 UNION 和 UNION ALL](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-7/union-he-union-all.md)
- [8.2 INTERSECT 模拟](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-7/intersect-mo-ni.md)
- [第九节 修改数据](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8.md)
- [9.1 INSERT 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/insert-yu-ju.md)
- [9.2 INSERT IGNORE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/insert-ignore.md)
- [9.3 UPDATE 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/update-yu-ju.md)
- [9.4 UPDATE JOIN 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/update-join-yu-ju.md)
- [9.5 DELETE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/delete.md)
- [9.6 ON DELETE CASCADE.](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/on-delete-cascade.md)
- [9.7 DELETE JOIN](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/delete-join.md)
- [9.8 REPLACE 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/replace-yu-ju.md)
- [9.9 PREPARE 语句](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-8/prepare-yu-ju.md)
- [第十节 事务](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-9.md)
- [10.1 事务介绍](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-9/shi-wu-jie-shao.md)
- [10.2 表锁定](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-9/biao-suo-ding.md)
- [第十一节 管理数据库和表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10.md)
- [11.1 数据库管理](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/shu-ju-ku-guan-li.md)
- [11.2 MySQL 表类型](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/biao-lei-xing.md)
- [11.3 CREATE TABLE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/create-table.md)
- [11.4 序列](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/xu-lie.md)
- [11.5 ALTER TABLE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/alter-table.md)
- [11.6 重命名表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/zhong-ming-ming-biao.md)
- [11.7 从表中删除列](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/cong-biao-zhong-shan-chu-lie.md)
- [11.8 向表中添加新列](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/xiang-biao-zhong-tian-jia-xin-lie.md)
- [11.9 删除表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/shan-chu-biao.md)
- [11.10 临时表](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/lin-shi-biao.md)
- [11.11 TRUNCATE TABLE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-10/truncate-table.md)
- [第十二节 索引](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-11.md)
- [12.1 管理索引](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-11/guan-li-suo-yin.md)
- [12.1 UNIQUE 索引](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-11/unique-suo-yin.md)
- [第十三节 数据类型](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12.md)
- [13.1 INT](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/int.md)
- [13.2 DECIMAL](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/decimal.md)
- [13.3 BIT](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/bit.md)
- [13.4 BOOLEAN](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/boolean.md)
- [13.5 CHAR](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/char.md)
- [13.6 VARCHAR](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/varchar.md)
- [13.7 TEXT](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/text.md)
- [13.8 DATE](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/date.md)
- [13.9 TIME](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/time.md)
- [13.10 DATETIME](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/datetime.md)
- [13.11 TIMESTAMP](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/timestamp.md)
- [13.12 JSON](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/json.md)
- [13.13 ENUM](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-12/enum.md)
- [第十四节 约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13.md)
- [14.1 NOT NULL 约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13/not-null-yue-shu.md)
- [14.2 主键约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13/zhu-jian-yue-shu.md)
- [14.2 外键约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13/wai-jian-yue-shu.md)
- [14.4 UNIQUE 约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13/unique-yue-shu.md)
- [14.5 CHECK 约束](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-13/check-yue-shu.md)
- [第十五节 全球化](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-14.md)
- [15.1 字符集](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-14/zi-fu-ji.md)
- [15.2 校对规则](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-14/xiao-dui-gui-ze.md)
- [第十六节 导入和导出](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-15.md)
- [16.1 导入 CSV 文件](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-15/dao-ru-csv-wen-jian.md)
- [16.2 导出为 CSV](https://hezhiqiang-book.gitbook.io/mysql/di-yi-zhang/index-15/dao-chu-wei-csv.md)
- [第二章 技巧](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang.md)
- [CTE 简介](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/gong-gong-biao-biao-da-shi.md)
- [递归 CTE](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/di-gui-cte.md)
- [邻接列表模型和层次结构](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/lin-jie-lie-biao-mo-xing-he-ceng-ci-jie-gou.md)
- [获取行数](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/huo-qu-hang-shu.md)
- [比较表](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/bi-jiao-biao.md)
- [找重复值](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/zhao-zhong-fu-zhi.md)
- [删除重复行](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/shan-chu-zhong-fu-hang.md)
- [UUID 和主键](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/uuid-he-zhu-jian.md)
- [复制表数据](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/fu-zhi-biao-shu-ju.md)
- [变量](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/bian-liang.md)
- [生成列](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/sheng-cheng-lie.md)
- [连续行比较](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/lian-xu-hang-bi-jiao.md)
- [更改存储引擎](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/geng-gai-cun-chu-yin-qing.md)
- [基于正则表达式的搜索](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/ji-yu-zheng-ze-biao-da-shi-de-sou-suo.md)
- [row\_number 模拟](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/rownumber-mo-ni.md)
- [随机选择记录](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/sui-ji-xuan-ze-ji-lu.md)
- [选择第 n 个最高纪录](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/xuan-ze-dinge-zui-gao-ji-lu.md)
- [重置自动增量值](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/zhong-zhi-zi-dong-zeng-liang-zhi.md)
- [MariaDB 与 MySQL 比较](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/mariadb-yu-mysql-bi-jiao.md)
- [间隔](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/jian-ge.md)
- [NULL 详细和应用](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/null-xiang-xi-he-ying-yong.md)
- [获取今天的日期](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/huo-qu-jin-tian-de-ri-qi.md)
- [将NULL值映射到有意义的值](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/jiang-null-zhi-ying-she-dao-you-yi-yi-de-zhi.md)
- [注释](https://hezhiqiang-book.gitbook.io/mysql/di-er-zhang/zhu-shi.md)
- [第三章 存储过程](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang.md)
- [简介](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/jian-jie.md)
- [入门](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/ru-men.md)
- [变量](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/bian-liang.md)
- [参数](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/can-shu.md)
- [返回多个值](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/fan-hui-duo-ge-zhi.md)
- [IF语句](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/if-yu-ju.md)
- [CASE语句](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/case-yu-ju.md)
- [IF和CASE语句的技巧](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/if-he-case-yu-ju-de-ji-qiao.md)
- [循环](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/xun-huan.md)
- [游标](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/you-biao.md)
- [列出存储过程](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/lie-chu-cun-chu-guo-cheng.md)
- [错误处理](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/cuo-wu-chu-li.md)
- [SIGNAL 和 ESIGNAL 语句](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/signal-he-esignal-yu-ju.md)
- [存储函数](https://hezhiqiang-book.gitbook.io/mysql/di-san-zhang/cun-chu-han-shu.md)
- [第四章 触发器](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang.md)
- [实现](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/shi-xian.md)
- [创建](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/chuang-jian.md)
- [创建多个触发器](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/chuang-jian-duo-ge-chu-fa-qi.md)
- [管理](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/guan-li.md)
- [计划事件](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/ji-hua-shi-jian.md)
- [修改事件](https://hezhiqiang-book.gitbook.io/mysql/di-si-zhang/xiu-gai-shi-jian.md)
- [第五章 视图](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang.md)
- [简介](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/jian-jie.md)
- [实现和限制](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/shi-xian-he-xian-zhi.md)
- [创建](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/chuang-jian.md)
- [可更新视图](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/ke-geng-xin-shi-tu.md)
- [确保视图一致性](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/que-bao-shi-tu-yi-zhi-xing.md)
- [检查选项子句](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/jian-cha-xuan-xiang-zi-ju.md)
- [管理](https://hezhiqiang-book.gitbook.io/mysql/di-wu-zhang/guan-li.md)
- [第六章 全文搜索](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang.md)
- [简介](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/jian-jie.md)
- [定义索引](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/ding-yi-suo-yin.md)
- [自然语言全文搜索](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/zi-ran-yu-yan-quan-wen-sou-suo.md)
- [布尔全文搜索](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/bu-er-quan-wen-sou-suo.md)
- [查询扩展](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/cha-xun-kuo-zhan.md)
- [ngram全文解析器](https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/ngram-quan-wen-jie-xi-qi.md)
- [第七章 函数](https://hezhiqiang-book.gitbook.io/mysql/di-qi-zhang.md)
- [第八章 管理](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang.md)
- [访问控制系统入门](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/fang-wen-kong-zhi-xi-tong-ru-men.md)
- [创建用户](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/chuang-jian-yong-hu.md)
- [授予权限](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/shou-yu-quan-xian.md)
- [撤销权限](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/che-xiao-quan-xian.md)
- [角色管理](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/jiao-se-guan-li.md)
- [删除用户](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/shan-chu-yong-hu.md)
- [维护数据库表](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/wei-hu-shu-ju-ku-biao.md)
- [备份数据库](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/bei-fen-shu-ju-ku.md)
- [列出数据库](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/lie-chu-shu-ju-ku.md)
- [列出表](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/lie-chu-biao.md)
- [列出表的列](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/lie-chu-biao-de-lie.md)
- [列出用户](https://hezhiqiang-book.gitbook.io/mysql/di-ba-zhang/lie-chu-yong-hu.md)
