

MySQL 零碎知识 - MySQL必知必会
source link: https://jiajunhuang.com/articles/2017_07_26-mysql.md.html?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

重读《MySQL必知必会》
-
DISTINCT
作用于其后面的所有列 -
DESRIBE
相当于SHOW COLUMNS FROM
-
SELECT xxx FROM table WHERE a = 'Hello'
能匹配出Hello
和hello
。因为 MySQL在执行匹配时默认不区分大小写 -
单引号用来限定字符串,数值列则不需要
-
通配符
%
匹配0到多个字符,_
匹配一个字符 -
REGEXP
后接正则表达式匹配 -
和其他SQL不同,MySQL使用
concat
函数拼接字段,而不是使用+
或者||
-
+ - * /
是算术运算 -
HAVING
完全可替代WHERE
,不过,一般把HAVING
用在分组的数据上 -
UNION
操作,我从来没在实际生产上用过,其实就是在多个表里组织处数据结构相同 的表,然后通过UNION
组成一张虚拟表,不过估计是性能杀手来着。UNION
默认 去除了重复的行,使用UNION ALL
可以取消这种行为。 -
全文索引,使用关键字
FULLTEXT
, MySQL5.6已经支持 -
使用
RENAME TABLE xxx TO yyy
来重命名
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK