摘要:order by 后 group by连用, mysql好像 >5.4不起作用 通过 explain 查看执行计划,可以看到没有 limit 的时候,少了一个 DERIVED 操作 估计是内部优化了,认为 ORDER BY 在这种语法中可忽略, 有 LIMIT 限制涉及排序后的结果,不会忽略 ORD
阅读全文
摘要:1、in 后面是记录集,如: select * from table where uname in(select uname from user); 2、in 后面是字符串,如: select * from table where uname in('aaa',bbb','ccc','ddd','e
阅读全文
摘要:虚拟机安装mysql数据库的时候遇到一个问题:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 参考网上相关的方法,包括:(http://blog.csdn.net/lmss82/archive/2009
阅读全文
摘要:我们都知道SQL中适用case when then来转化数据库中的信息 比如 select (case sex when 0 then '男' else '女' end) AS sex from studentInfo 那么在集合函数中它有什么用呢 ? 假设数据库有一张表名为student的表。 如
阅读全文