Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_mysql
提交
42398a8c
S
skill_tree_mysql
项目概览
CSDN 技术社区
/
skill_tree_mysql
通知
21
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_mysql
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
42398a8c
编写于
6月 06, 2022
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
all
上级
785557c9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
150 addition
and
7 deletion
+150
-7
data/2.MySQL中阶/6.子查询/2. ANY/any.json
data/2.MySQL中阶/6.子查询/2. ANY/any.json
+8
-0
data/2.MySQL中阶/6.子查询/2. ANY/any.md
data/2.MySQL中阶/6.子查询/2. ANY/any.md
+51
-0
data/2.MySQL中阶/6.子查询/2. ANY/config.json
data/2.MySQL中阶/6.子查询/2. ANY/config.json
+12
-3
data/2.MySQL中阶/6.子查询/3.ALL/all.json
data/2.MySQL中阶/6.子查询/3.ALL/all.json
+8
-0
data/2.MySQL中阶/6.子查询/3.ALL/all.md
data/2.MySQL中阶/6.子查询/3.ALL/all.md
+56
-0
data/2.MySQL中阶/6.子查询/3.ALL/config.json
data/2.MySQL中阶/6.子查询/3.ALL/config.json
+7
-2
data/tree.json
data/tree.json
+8
-2
未找到文件。
data/2.MySQL中阶/6.子查询/2. ANY/any.json
0 → 100644
浏览文件 @
42398a8c
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"any.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"3eaab3e2a9cd45e2ab238e6943609861"
}
\ No newline at end of file
data/2.MySQL中阶/6.子查询/2. ANY/any.md
0 → 100644
浏览文件 @
42398a8c
# ANY
Joe 想要从员工表
```
mysql
create table employee(
id int primary key auto_increment,
name varchar(256),
dept varchar(256),
salary decimal(12, 4)
);
```
构造一个员工列表,排除每个部门最高工资的员工。这个查询可以怎样写?
## 答案
```
mysql
select id, name, dept, salary
from employee as o
where o.salary < any(select salary from employee as i where i.dept=o.dept)
```
## 选项
### A
```
mysql
select id, name, dept, salary
from employee as o
join employee as i on o.dept = i.dept and o.salary < i.salary
```
### B
```
mysql
select o.id, o.name, o.dept, o.salary
from employee as o
left join employee as i on o.dept = i.dept and o.salary < i.salary
where i.id is null;
```
### C
```
mysql
select o.id, o.name, o.dept, o.salary
from employee as o
left join employee as i on o.dept = i.dept and o.salary < i.salary
where i.id is not null;
```
\ No newline at end of file
data/2.MySQL中阶/6.子查询/2. ANY/config.json
浏览文件 @
42398a8c
{
"node_id"
:
"mysql-6bb279fa10fa4633a3af51ff7001f5ce"
,
"keywords"
:
[
"subquery"
,
"子查询"
,
"any"
],
"keywords"
:
[
"subquery"
,
"子查询"
,
"any"
],
"children"
:
[],
"export"
:
[],
"export"
:
[
"any.json"
],
"keywords_must"
:
[
[
"mysql"
,
"any"
]
[
"mysql"
,
"any"
]
],
"keywords_forbid"
:
[],
"group"
:
0
...
...
data/2.MySQL中阶/6.子查询/3.ALL/all.json
0 → 100644
浏览文件 @
42398a8c
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"all.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"f2a50fcc0b8d4417a69b956c26eeed7a"
}
\ No newline at end of file
data/2.MySQL中阶/6.子查询/3.ALL/all.md
0 → 100644
浏览文件 @
42398a8c
# ALL
Joe 想从员工表
```
mysql
create table employee(
id int primary key auto_increment,
dept int,
name varchar(256),
post varchar(16)
)
```
中找出所有其所在部门没有助理(post 为
`assistant`
)的员工信息。由于 Joe 没有其它表的查询权限,他只能查询员工表,这个查询应该是:
## 答案
```
mysql
select id, name, dept
from employee as o
where 'assistant' != all(select post from employee as i where o.dept = i.dept);
```
## 选项
### A
```
mysql
select id, name, dept
from employee as o
where 'assistant' = all(select post from employee as i where o.dept = i.dept);
```
### B
```
mysql
select id, name, dept
from employee as o
where 'assistant' != all(select post from employee as i where o.dept = i.dept);
```
### C
```
mysql
select id, name, dept
from employee as o
where 'assistant' != all(select post from employee as i);
```
### D
```
mysql
select id, name, dept
from employee as o
where 'assistant' != ANY(select post from employee as i where o.dept = i.dept);
```
\ No newline at end of file
data/2.MySQL中阶/6.子查询/3.ALL/config.json
浏览文件 @
42398a8c
...
...
@@ -2,9 +2,14 @@
"node_id"
:
"mysql-87c2d9bc921643aabfd1b12b964ef557"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"all.json"
],
"keywords_must"
:
[
[
"mysql"
,
"all"
]
[
"mysql"
,
"all"
]
],
"keywords_forbid"
:
[],
"group"
:
0
...
...
data/tree.json
浏览文件 @
42398a8c
...
...
@@ -1036,7 +1036,10 @@
{
" RIGHT JOIN"
:
{
"node_id"
:
"mysql-7c2331eea3e84eef9464ad4d7c03e2de"
,
"keywords"
:
[],
"keywords"
:
[
"right join"
,
"右连接"
],
"children"
:
[],
"keywords_must"
:
[
[
...
...
@@ -2487,7 +2490,10 @@
{
" PT-QUERY-DIGEST分析查询"
:
{
"node_id"
:
"mysql-626f1ca763b344558b3a5eefdb4885a2"
,
"keywords"
:
[],
"keywords"
:
[
"pt-query-digest"
,
"优化"
],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录