mysql-notes
mysql-notes copied to clipboard
MySQL 学习笔记
SQL:1999 **`recursive common table expression`** 1. [A Definitive Guide To MySQL Recursive CTE](https://www.mysqltutorial.org/mysql-recursive-cte/)
```sql -- 当前日期 SELECT CURDATE(); -- 当前日期+时间 SELECT NOW(); -- 明天 SELECT ADDDATE(CURDATE(), 1); -- 昨天 SELECT SUBDATE(CURDATE(), 1); -- 上周 SELECT SUBDATE(CURDATE(), 7), SUBDATE(CURDATE(), 1); -- 下周 SELECT ADDDATE(CURDATE(),...
```sql -- 查看数据库字符集 USE db_name; SELECT @@character_set_database, @@collation_database; show variables like 'character_set_database'; show variables like 'collation_database'; SHOW CREATE DATABASE "schemaName"; -- 查看数据库字符集 -- https://stackoverflow.com/a/1049958/951836 SELECT schema_name, default_character_set_name, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA;...
== ch01  从 MySQL 5.7.20 开始,不推荐使用查询缓存,在 MySQL 8.0 中直接删除了查询缓存。 server 层与存储引擎层交互时,一般是以记录为单位的。 server 层在判断记录符合条件后,先将其发送到一个缓存区,待缓存区满之后,才向客户端发送真正的记录,可以通过 `net_buffer_length` 控制缓存区大小。 InNoDB 从 MySQL 5.5.5 开始作为 MySQL 的默认存储引擎。 ```sql -- 显示支持引擎类型 SHOW ENGINES; -- 指定表的引擎类型...
简单一句话总结: MySQL 8.0 支持新的排序规则 `utf8mb4_0900_ai_ci`,优先考虑使用这个规则。 1. [New collations in MySQL 8.0.0 | MySQL Server Blog](http://mysqlserverteam.com/new-collations-in-mysql-8-0-0/) 2. [MySQL 8.0 Collations: The devil is in the details. | MySQL Server Blog](https://mysqlserverteam.com/mysql-8-0-collations-the-devil-is-in-the-details/) 3....
```sql select id, uuid, billId, -- 各种字段 from bill_rule where uuid= '1' and billId = (select billId from bill_rule where uuid= '1' and billStatus = 1 order by billDate desc...
[数据库的原理.pdf](https://github.com/diguage/mysql-notes/files/9922039/default.pdf)