
mysql
z1340954953
男儿当自强
展开
-
MySQL5.7 安装报错 --initialize specified but the data directory exists and is not writable
看报错信息,一直以为是data目录没有写入的权限,鼓捣了半天,害。。。结果是my.ini 文件配置的问题。文件目录路径写的是单斜杠导致的,路径改成双斜杠,再次执行初始化命令就OK了更改后的my.ini 文件[client]port=3306default-character-set=utf8[mysqld]skip-grant-tablesport=3306character_set_server=utf8basedir=D:\\tools\\mysql-5.7.32-win原创 2020-10-28 19:54:32 · 6716 阅读 · 2 评论 -
MySQL Order By实现原理分析和FileSort优化
在MySQL中的ORDER BY有两种排序实现方式:1. 利用有序索引获取有序数据2. 文件排序使用explain分析查询的时候,通过索引排序数据显示 using index,排序没有用到索引则是using filesort注意:My SQL在查询时最多只能使用一个索引。因此,如果where条件中使用到了索引,那么在排序中就不使用索引了。order by 使用索引的情况1)...转载 2018-10-17 15:20:08 · 262 阅读 · 0 评论 -
MySQL如何利用索引优化ORDER BY排序语句
官网排序优化:http://dev.mysql.com/doc/refman/5.5/en/order-by-optimization.html MySql创建索引时支持ASC或DESC排序。下面举例创建表时同时创建索引降序排序(sname 字段上普通索引降序)create table tbl1 (id int unique, sname varchar(50),index tb...转载 2018-10-17 14:49:27 · 697 阅读 · 0 评论 -
mysql update join,insert select 语法
#MySQL更新操作update table_a m join table_b non m.gain_no = n.MOBILE_PHONEset m.gain_no = n.AIP_NO,m.gain_type = '1'where m.gain_type = '2' and m.gain_no in ('')#MySQL批量添加insert into table_a (clo1,cl...转载 2018-03-16 17:40:42 · 559 阅读 · 0 评论 -
mysql查缺补漏(三) count函数问题和行列转置
count函数问题1. 使用count(别名.*)遇到的问题举个例子说:SELECT COUNT(a.*),AVG(b.ps_score),COUNT(b.*)FROM qdwyc_dd a LEFT JOIN qdwyc_evaluation_score b ON a.dd_num=b.dd_num WHERE a.xc_status=4 and b.ps_type=1转载 2018-01-23 16:12:39 · 447 阅读 · 0 评论 -
mysql查缺补漏(二)mysql5.6性能优化(explain执行计划术语,索引,优化查询)
explain术语,索引,查询优化,索引不生效情况,插入优化转载 2018-01-22 15:57:45 · 541 阅读 · 0 评论 -
mysql查缺补漏(一) and or优先级和多表join
1. and 和 or 的优先级问题在where字句中出现多个and or ,and的优先级 先于or的优先级,select * from table1 where id = 1 or id =2 and name = 'zhouy'结果: id =1 或 id=2 && name = 'zhouy'在出现多个and, or 可以使用括号()改变优先级,捋清楚条件select转载 2018-01-12 16:07:32 · 1319 阅读 · 0 评论 -
mysql 别名失效
mysql 别名不起作用,trim 处理解决转载 2017-12-01 09:16:30 · 705 阅读 · 0 评论 -
批量 insert into select 和 批量 replace into select
Insert是T-sql中常用语句,Insert INTO table(field1,field2,...) values(value1,value2,...)这种形式的在应用程序开发中必不可少。但我们在开发、测试过程中,经常会遇到需要表复制的情况,如将一个table1的数据的部分字段复制到table2中,或者将整个table1复制到table2中,这时候我们就要使用SELECT INTO 和 I转载 2017-02-21 14:57:54 · 1227 阅读 · 0 评论 -
left join on后面条件失效
mysql left join on后面条件失效和解决方案原创 2017-08-28 11:00:45 · 5555 阅读 · 0 评论 -
mysql更新死锁
mysql更新死锁转载 2017-08-10 16:01:25 · 533 阅读 · 0 评论 -
mysql分组取前几条
mysql中获取分组中的前n项实现转载 2017-07-25 17:21:31 · 998 阅读 · 0 评论 -
mysql for update行级锁
mysql for update注意事项转载 2017-08-01 08:43:00 · 934 阅读 · 0 评论 -
mysql union all 排序无效
mysql union all 排序无效原创 2017-06-27 16:34:45 · 6345 阅读 · 2 评论 -
mysql sum 统计数值出现精度问题
mysql sum 累计求和精度问题原创 2017-06-23 15:50:51 · 11988 阅读 · 0 评论 -
mysql中树形结构查询
mysql树形结构查询原创 2017-07-01 09:35:00 · 5454 阅读 · 0 评论