随笔分类 -  数据库

摘要:参考:https://mp.weixin.qq.com/s/Vx4BBUZuOxlHNP3z5KPGs https://blog.csdn.net/samll_snail/article/details/89445749 偶然看了订阅号这篇文章,简单整理下 给一个表添加索引,默认id是主键索引,k字 阅读全文
posted @ 2020-09-25 10:24 蜗牛使劲冲 阅读(29) 评论(0) 推荐(0)
摘要:经过前段时间搞报表项目自己写sql的能力大大提升,下面这段是自己写的分析一下 select id as teacher_id,sum(leave_time) as total_leave_time from ( select ui.id,l.uid,(endtime-starttime) as le 阅读全文
posted @ 2020-04-09 17:31 蜗牛使劲冲 阅读(8) 评论(0) 推荐(0)
摘要:参考:https://www.cnblogs.com/luyucheng/p/6265594.html 慢查询:就是增加个log记录查询慢的sql语句,从而进行优化 首先先来mysql这边看下有没有开启慢查询 mysql> show variables like 'slow_query%' -> ; 阅读全文
posted @ 2019-10-05 14:24 蜗牛使劲冲 阅读(16) 评论(0) 推荐(0)
摘要:项目中,好像可以设置所有用户是一个普通用户,然后进行增删改查 // 寻找一组数据中较大的那个 "SELECT id,status,applyer_id FROM (select * from hc_applyer_info order by id DESC) b GROUP BY b.applyer 阅读全文
posted @ 2018-08-07 09:40 蜗牛使劲冲 阅读(14) 评论(0) 推荐(0)
摘要:在做项目时有时候为了更快的查询,需要在一些比较常用的字段上加索引,通常我都喜欢直接在navicat上直接改,然后慢慢的就源生的语句忘得差不多了,百度了会总结下: 可以直接alter table user add index username_index(name,uid),如果要加索引类型的话在ad 阅读全文
posted @ 2018-03-20 13:19 蜗牛使劲冲 阅读(10) 评论(0) 推荐(0)
摘要:参考地址:http://blog.csdn.net/jack__love/article/details/79019049 服务器环境centos7,本地windows电脑第一次连接mysql报Access denied for user 'root'@'localhost'(using passw 阅读全文
posted @ 2018-03-15 10:19 蜗牛使劲冲 阅读(28) 评论(0) 推荐(0)
摘要:好久没有自己电脑用navicat了今天打开用了下,发现navicat突然打不开了,显示 Access denied for user 'root'@'localhost' (using password:NO) 啊?这是什么报错,复制了这行提示到度娘找答案,找了好几个靠前头的,不是cmd就是任务管理 阅读全文
posted @ 2017-10-06 14:14 蜗牛使劲冲 阅读(14) 评论(0) 推荐(0)
摘要:left join以左表为主表,右表没有的则为空 right join以右表为主表,左表没有的则为空 inner join取左右两表的并集 阅读全文
posted @ 2017-09-16 11:26 蜗牛使劲冲 阅读(14) 评论(0) 推荐(0)
摘要:<?php ** //造连接对象 ** > `$db = new MySQLi("localhost","root","","0710_test");` //写SQL语句 ``` $sql = "select * from student"; ``` //检测连接数据库是否成功,失败返回“连接失败” 阅读全文
posted @ 2017-09-07 13:36 蜗牛使劲冲 阅读(11) 评论(0) 推荐(0)