_表示单个字符
SELECT * FROM employees WHERE first_name LIKE "___e%"; SELECT * FROM employees WHERE first_name LIKE "____";
查询以J开头,a结尾
SELECT * FROM employees WHERE first_name LIKE "J%"; SELECT * FROM employees WHERE first_name LIKE "%a";
取反
SELECT * FROM employees WHERE first_name NOT LIKE "%a";
区分大小写
# 默认大小写不敏感 SELECT * FROM employees WHERE first_name LIKE "j%"; # 区别大小写 SELECT * FROM employees WHERE first_name LIKE BINARY "j%";
正则表达式
# 正则表达式 SELECT * FROM employees WHERE last_name REGEXP '^a|e$';
查询系统设置
# 第一次查询很慢,第二次直接命中缓存。 #当缓冲池数据页被更新时,InnoDB 会将这个数据页标记为脏页(dirty page)。脏页表示该数据页在 Buffer Pool 中的内容与磁盘上的数据不一致,需要在某个时刻将更新的数据写回到磁盘。 # 缓冲池默认 134217728=128M SHOW VARIABLES LIKE 'innodb_buffer_pool_size'; # 最大脏页比例默认为 90% SHOW VARIABLES LIKE 'innodb_max_dirty_pages_pct';
标签:LIKE,employees,模糊,查询,mysql,first,WHERE,SELECT,name From: https://www.cnblogs.com/rtnb/p/18286945