码迷,mamicode.com
首页 >  
搜索关键字:distinct    ( 3361个结果
[LeetCode] 940. Distinct Subsequences II
Given a string S, count the number of distinct, non-empty subsequences of S . Since the result may be large, return the answer modulo 10^9 + 7. Exampl ...
分类:其他好文   时间:2020-03-18 09:38:23    阅读次数:52
SQL语句排序(非常重要)
from——where——group by——having——select——distinct——order by——limit 1.找到表:from 2.拿着where指定的约束条件,去文件/表中取出一条条记录 3. 将取出的一条条记录进行分组group by,如果没有group by,则整体作为 ...
分类:数据库   时间:2020-03-16 10:03:29    阅读次数:82
1380. Lucky Numbers in a Matrix
Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it ...
分类:其他好文   时间:2020-03-16 09:41:48    阅读次数:34
ORDER BY导致索引使用不理想
原文:ORDER BY导致索引使用不理想 在MySQL中经常出现未按照理想情况使用索引的情况,今天记录一种Order by语句的使用导致未按预期使用索引的情况。 1. 问题现象 1.1 SQL语句: SELECT DISTINCT p.* FROM tb_name p WHERE 1=1 AND p... ...
分类:其他好文   时间:2020-03-15 22:37:24    阅读次数:86
MySQL-DAY02
MySQL-DAY02 1. 查询结果去重 mysql> select distinct job from emp; // distinct关键字去除重复记录。 注意:distinct只能出现在所有字段的最前面。 2. 连接查询 2.1 连接查询的分类 根据语法出现的年代来划分的话,包括: SQL9 ...
分类:数据库   时间:2020-03-14 13:04:33    阅读次数:78
mysql—group_concat函数
MySQL中的group_concat函数的使用方法,比如select group_concat(name) 。 完整的语法如下: group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符']) 举个例子 我们想查 ...
分类:数据库   时间:2020-03-14 12:45:12    阅读次数:74
mysql常见面试题
176.编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary) 。 select distinct Salary as SecondHighestSalary from Employee order by Salary desc limit 1 offset 1; 184. ...
分类:数据库   时间:2020-03-12 23:23:34    阅读次数:86
SQL 将一列多行数据合并为一行
原表数据: 期望结果: 使用STUFF + FOR XML PATH即可实现以上效果 执行以下SQL: SELECT DISTINCT Name, STUFF((SELECT ',' + Course FROM Student WHERE Name = T.Name FOR XML PATH('') ...
分类:数据库   时间:2020-03-11 01:03:27    阅读次数:72
mysql性能优化 profile
--查看当前的mysql版本是否支持 show variables like 'profiling%'; --默认关闭,使用前需要开启set profiling=on; --运行耗时久的sql SELECT DISTINCT io.housing_id FROM t_device_report_me ...
分类:数据库   时间:2020-03-10 12:10:30    阅读次数:84
mysql执行计划 const eq_ref ref range index all
| id | SELECT识别符。这是SELECT的查询序列号 | | | | | select_type | SELECT类型,可以为以下任何一种: SIMPLE :简单SELECT(不使用UNION或子查询) PRIMARY :最外面的SELECT UNION :UNION中的第二个或后面的SE ...
分类:数据库   时间:2020-03-09 20:53:19    阅读次数:166
3361条   上一页 1 ... 17 18 19 20 21 ... 337 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!