DISTINCT 在所有列上转换为 GROUP BY,并与 ORDER BY 子句结合使用。 SELECT DISTINCT t1.a FROM t1,t2 where t1.a=t2.a; ...
分类:
数据库 时间:
2020-07-13 18:13:23
阅读次数:
172
查看某张表已经存在的索引以及类型 SELECT b.uniqueness, a.index_name, a.table_name, a.column_name FROM all_ind_columns a, all_indexes b WHERE a.index_name=b.index_name ...
分类:
数据库 时间:
2020-07-13 15:17:38
阅读次数:
84
1.使用条件查询 查询部门为20的员工列表 -- 查询部门为20的员工列表 SELECT t.DEPTNO,t.ENAME FROM SCOTT.EMP t where t.DEPTNO = '20' ; 效果:2.使用 listagg() WITHIN GROUP () 将多行合并成一行(比较常用 ...
分类:
数据库 时间:
2020-07-13 11:32:09
阅读次数:
81
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render fun... ...
分类:
其他好文 时间:
2020-07-12 18:50:22
阅读次数:
74
序言 为什么InnoDB不将总数存起来? InnoDB直接count(*)会遍历全表(没有where条件),虽然结果准确,但会导致性能问题。 按照效率排序的话,count(字段)<count(主键id)<count(1)≈count(*),所以建议读者,尽量使用count(*)。 资料 ...
分类:
数据库 时间:
2020-07-12 12:29:06
阅读次数:
60
1 #1.查询工资最低的员工信息:last name, salary 2 SELECT 3 last_name, 4 salary 5 FROM 6 employees 7 WHERE 8 salary = ( 9 SELECT 10 MIN(salary) 11 FROM 12 employees ...
分类:
数据库 时间:
2020-07-12 10:44:40
阅读次数:
76
外键约束; 涉及到两个表:父表,子表; 主表和副表。 --班级 create table classes( id int primary key, name varchar(20) ); --学生表 create table students( id int primary key, name va ...
分类:
数据库 时间:
2020-07-12 10:30:21
阅读次数:
79
A Bug's Life Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different gend ...
分类:
其他好文 时间:
2020-07-11 17:33:44
阅读次数:
54
以下是广泛使用的30个SQL查询语句优化方法: 1、应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使用索引而进行全表扫描。 2、对查询进行优化,首先应考虑在 where 及 order by 涉及的列上建立索引,避免全表扫描。 3、应尽量避免在 where 子句中对字段进行 n ...
分类:
数据库 时间:
2020-07-11 11:17:01
阅读次数:
75
Rotate List (M) 题目 Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2->3->4->5->NULL, k = ...
分类:
其他好文 时间:
2020-07-11 09:40:09
阅读次数:
39