Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_mysql
提交
785557c9
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看板
提交
785557c9
编写于
6月 06, 2022
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
join
上级
f411bfa8
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
365 addition
and
95 deletion
+365
-95
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/config.json
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/config.json
+7
-2
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.json
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.json
+8
-0
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.md
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.md
+76
-0
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/config.json
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/config.json
+7
-2
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.json
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.json
+8
-0
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.md
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.md
+70
-0
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/config.json
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/config.json
+8
-3
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.json
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.json
+8
-0
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.md
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.md
+73
-0
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/config.json
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/config.json
+7
-2
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.json
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.json
+8
-0
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.md
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.md
+83
-0
data/3.MySQL高阶/6.运维与架构/7.延迟复制/delay.md
data/3.MySQL高阶/6.运维与架构/7.延迟复制/delay.md
+1
-1
data/3.MySQL高阶/7.查询优化/1. SHOW STATUS/config.json
data/3.MySQL高阶/7.查询优化/1. SHOW STATUS/config.json
+0
-0
data/3.MySQL高阶/7.查询优化/1. 嵌套查询/config.json
data/3.MySQL高阶/7.查询优化/1. 嵌套查询/config.json
+0
-10
data/3.MySQL高阶/7.查询优化/2. EXPLAIN/config.json
data/3.MySQL高阶/7.查询优化/2. EXPLAIN/config.json
+0
-0
data/3.MySQL高阶/7.查询优化/2.ORDER BY 优化/config.json
data/3.MySQL高阶/7.查询优化/2.ORDER BY 优化/config.json
+0
-10
data/3.MySQL高阶/7.查询优化/3. SHOW PROFILE/config.json
data/3.MySQL高阶/7.查询优化/3. SHOW PROFILE/config.json
+0
-0
data/3.MySQL高阶/7.查询优化/3.分页查询优化/config.json
data/3.MySQL高阶/7.查询优化/3.分页查询优化/config.json
+0
-10
data/3.MySQL高阶/7.查询优化/4. PT-QUERY-DIGEST分析查询/config.json
data/3.MySQL高阶/7.查询优化/4. PT-QUERY-DIGEST分析查询/config.json
+1
-1
data/3.MySQL高阶/7.查询优化/4.GROUP BY优化/config.json
data/3.MySQL高阶/7.查询优化/4.GROUP BY优化/config.json
+0
-10
data/3.MySQL高阶/7.查询优化/5.子查询优化/config.json
data/3.MySQL高阶/7.查询优化/5.子查询优化/config.json
+0
-0
data/tree.json
data/tree.json
+0
-44
未找到文件。
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/config.json
浏览文件 @
785557c9
...
@@ -2,9 +2,14 @@
...
@@ -2,9 +2,14 @@
"node_id"
:
"mysql-73bfbd883511436c85130b71fa108038"
,
"node_id"
:
"mysql-73bfbd883511436c85130b71fa108038"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"join_self.json"
],
"keywords_must"
:
[
"keywords_must"
:
[
[
"mysql"
,
"inner join"
]
[
"mysql"
,
"inner join"
]
],
],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.json
0 → 100644
浏览文件 @
785557c9
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"join_self.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"59e9daf6f4444c2988785af0b75dda10"
}
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/1.INNER JOIN/join_self.md
0 → 100644
浏览文件 @
785557c9
# 自连接
现有 node 表如下:
```
mysql
create table node(
id int primary key auto_increment,
pid int,
content varchar(256)
)
```
现在Joe 想要给出 content 以
`fork-`
开头的所有节点,和它们的子节点,输出
`parent_id, parent_content, child_id, child_content`
。
他应该怎么做?
## 答案
```
mysql
select l.id as parent_id,
l.content as parent_content,
r.id as child_id,
r.content as child_content
from node as l
join node as r on l.id = r.pid
where l.content like 'fork-%';
```
## 选项
### A
```
mysql
select l.id as parent_id,
l.content as parent_content,
r.id as child_id,
r.content as child_content
from node as l
right join node as r on l.id = r.pid
where l.content like 'fork-%';
```
### B
```
mysql
select l.id as parent_id,
l.content as parent_content,
r.id as child_id,
r.content as child_content
from node as l, node as r
where l.id =(+) r.pid l.content like 'fork-%';
```
### C
```
mysql
select l.id as parent_id,
l.content as parent_content,
r.id as child_id,
r.content as child_content
from node as l
cross join node as r on l.id = r.pid
where l.content like 'fork-%';
```
### D
```
mysql
select l.id as parent_id,
l.content as parent_content,
r.id as child_id,
r.content as child_content
from node as l
join node as r on l.pid = r.id
where l.content like 'fork-%';
```
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/config.json
浏览文件 @
785557c9
...
@@ -2,9 +2,14 @@
...
@@ -2,9 +2,14 @@
"node_id"
:
"mysql-d7a8869fb798498c839c913ce930015d"
,
"node_id"
:
"mysql-d7a8869fb798498c839c913ce930015d"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"left_join.json"
],
"keywords_must"
:
[
"keywords_must"
:
[
[
"mysql"
,
"left join"
]
[
"mysql"
,
"left join"
]
],
],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.json
0 → 100644
浏览文件 @
785557c9
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"left_join.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"67515869f4fa4661ba858305e5c85c72"
}
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/2. LEFT JOIN/left_join.md
0 → 100644
浏览文件 @
785557c9
# 左连接
现有部门表
```
mysql
create table department(
id int primary key auto_increment,
name varchar(256)
)
```
和员工表
```
mysql
create table employee(
id int primary key auto_increment,
dept int,
name varchar(256),
post varchar(16)
)
```
Joe 想要列出所有的部门,如果这个部门有部门助理(post 为
`assistant`
),则将 stuff 的名字也列出来,那么这个查询应该是:
## 答案
```
mysql
select d.id, d.name, e.name as assistant
from department as d
left join employee as e on e.dept = d.id
where e.post = 'assistant'
```
## 选项
### A
```
mysql
select d.id, d.name, e.name as assistant
from department as d
cross join employee as e on e.dept = d.id
where e.post = 'assistant'
```
### B
```
mysql
select d.id, d.name, e.name as assistant
from department as d
join employee as e on e.dept = d.id
where e.post = 'assistant'
```
### C
```
mysql
select d.id, d.name, e.name as assistant
from department as d
cross join employee as e on e.dept = d.id
where e.post = 'assistant'
```
### D
```
mysql
select d.id, d.name, e.name as assistant
from employee as e
left join department as d on e.dept = d.id
where e.post = 'assistant'
```
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/config.json
浏览文件 @
785557c9
{
{
"node_id"
:
"mysql-7c2331eea3e84eef9464ad4d7c03e2de"
,
"node_id"
:
"mysql-7c2331eea3e84eef9464ad4d7c03e2de"
,
"keywords"
:
[],
"keywords"
:
[
"right join"
,
"右连接"
],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"right_join.json"
],
"keywords_must"
:
[
"keywords_must"
:
[
[
"mysql"
,
"right join"
]
[
"mysql"
,
"right join"
]
],
],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.json
0 → 100644
浏览文件 @
785557c9
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"right_join.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"fbfdc54da9d44fbca30f7a293469bf47"
}
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/3. RIGHT JOIN/right_join.md
0 → 100644
浏览文件 @
785557c9
# 右连接
现有部门表
```
mysql
create table department(
id int primary key auto_increment,
name varchar(256)
)
```
和员工表
```
mysql
create table employee(
id int primary key auto_increment,
dept int,
name varchar(256),
post varchar(16)
)
```
公司经过了一轮调整后,员工信息有些混乱,现在 Joe 要写一个查询,找出部门信息写
错的员工,这些员工所在的部门在 department 表中没有对应记录。
## 答案
```
mysql
select e.id, e.name, e.dept
from department as d
right join employee as e on d.id = e.dept
where d.id is null;
```
## 选项
### A
```
mysql
select e.id, e.name, e.dept
from employee as e
right join department as d on d.id = e.dept
where e.id is null;
```
### B
```
mysql
select e.id, e.name, e.dept
from employee as e
right join department as d on d.id = e.dept
where d.id is null;
```
### C
```
mysql
select e.id, e.name, e.dept
from department as d
join employee as e on d.id = e.dept
where d.id is null;
```
### D
```
mysql
select e.id, e.name, e.dept
from department as d
right join employee as e on d.id = e.dept
where d.id is null;
```
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/config.json
浏览文件 @
785557c9
...
@@ -2,9 +2,14 @@
...
@@ -2,9 +2,14 @@
"node_id"
:
"mysql-fd27af20b046463eac7b2712885ac018"
,
"node_id"
:
"mysql-fd27af20b046463eac7b2712885ac018"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"cross_join.json"
],
"keywords_must"
:
[
"keywords_must"
:
[
[
"mysql"
,
"cross join"
]
[
"mysql"
,
"cross join"
]
],
],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.json
0 → 100644
浏览文件 @
785557c9
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"right_join.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"3d9153bd05ed41379bcb13eaadc41ef0"
}
\ No newline at end of file
data/2.MySQL中阶/4.连接查询/4. CROSS JOIN/cross_join.md
0 → 100644
浏览文件 @
785557c9
# Cross Join
Joe 需要生成 goods 表
```
mysql
create table goods(
id int primary key auto_increment,
category varchar(64),
name varchar(256),
price decimal(12, 4),
stock int,
upper_time timestamp
)
```
中所有T恤(category为
`T-Shirt`
)的所有尺寸,尺寸信息在 size 表
```
mysql
create table size(
id int primary key auto_increment,
name varchar(16)
)
```
中,那么这个查询应该是:
## 答案
```
mysql
select g.id, g.name, s.name as size
from goods as g
cross join size as s
where g.category = 'T-Shirt';
```
## 选项
### A
```
mysql
select g.id, g.name, s.name as size
from goods as g
full join size as s
where g.category = 'T-Shirt';
```
### B
```
mysql
select g.id, g.name, s.name as size
from goods as g
left join size as s
where g.category = 'T-Shirt';
```
### C
```
mysql
select g.id, g.name, s.name as size
from goods as g
left join size as s
where g.category = 'T-Shirt';
```
### D
```
mysql
select g.id, g.name, s.name as size
from goods as g
right join size as s
where g.category = 'T-Shirt';
```
### E
```
mysql
select g.id, g.name, s.name as size
from goods as g
outter join size as s
where g.category = 'T-Shirt';
```
data/3.MySQL高阶/6.运维与架构/7.延迟复制/delay.md
浏览文件 @
785557c9
# 延迟复制
# 延迟复制
在
`主从复制`
一节里,Joe实现了一个点对点的主从复制架构,其中
standby 是 trade
的从库,现在,
在
`主从复制`
一节里,Joe实现了一个点对点的主从复制架构,其中
standby 是 trade
的从库,现在,
Joe 要添加一个名为 backup 的新的复制节点,这个节点的同步进度要比 trade 晚半小时。他应该怎么做?
Joe 要添加一个名为 backup 的新的复制节点,这个节点的同步进度要比 trade 晚半小时。他应该怎么做?
## 答案
## 答案
...
...
data/3.MySQL高阶/7.查询优化/
5
. SHOW STATUS/config.json
→
data/3.MySQL高阶/7.查询优化/
1
. SHOW STATUS/config.json
浏览文件 @
785557c9
文件已移动
data/3.MySQL高阶/7.查询优化/1. 嵌套查询/config.json
已删除
100644 → 0
浏览文件 @
f411bfa8
{
"node_id"
:
"mysql-4381bed0477f412e80f0509b0e2bb3f9"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/7.查询优化/
6
. EXPLAIN/config.json
→
data/3.MySQL高阶/7.查询优化/
2
. EXPLAIN/config.json
浏览文件 @
785557c9
文件已移动
data/3.MySQL高阶/7.查询优化/2.ORDER BY 优化/config.json
已删除
100644 → 0
浏览文件 @
f411bfa8
{
"node_id"
:
"mysql-c140ce4a6f0a4557a3a5ce0b471fd6da"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/7.查询优化/
7
. SHOW PROFILE/config.json
→
data/3.MySQL高阶/7.查询优化/
3
. SHOW PROFILE/config.json
浏览文件 @
785557c9
文件已移动
data/3.MySQL高阶/7.查询优化/3.分页查询优化/config.json
已删除
100644 → 0
浏览文件 @
f411bfa8
{
"node_id"
:
"mysql-6e063c40f1ba485288eba2376097b79c"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/7.查询优化/
8
. PT-QUERY-DIGEST分析查询/config.json
→
data/3.MySQL高阶/7.查询优化/
4
. PT-QUERY-DIGEST分析查询/config.json
浏览文件 @
785557c9
{
{
"node_id"
:
"mysql-626f1ca763b344558b3a5eefdb4885a2"
,
"node_id"
:
"mysql-626f1ca763b344558b3a5eefdb4885a2"
,
"keywords"
:
[],
"keywords"
:
[
"pt-query-digest"
,
"优化"
],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
...
...
data/3.MySQL高阶/7.查询优化/4.GROUP BY优化/config.json
已删除
100644 → 0
浏览文件 @
f411bfa8
{
"node_id"
:
"mysql-66fc4566eaf34994b072ca83bf79ceb4"
,
"keywords"
:
[
"performance"
,
"优化"
,
"group by"
],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/7.查询优化/
9
.子查询优化/config.json
→
data/3.MySQL高阶/7.查询优化/
5
.子查询优化/config.json
浏览文件 @
785557c9
文件已移动
data/tree.json
浏览文件 @
785557c9
...
@@ -2448,50 +2448,6 @@
...
@@ -2448,50 +2448,6 @@
"node_id"
:
"mysql-310130dd922d4e2b832891cc0e157cbf"
,
"node_id"
:
"mysql-310130dd922d4e2b832891cc0e157cbf"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[
"children"
:
[
{
" 嵌套查询"
:
{
"node_id"
:
"mysql-4381bed0477f412e80f0509b0e2bb3f9"
,
"keywords"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
"ORDER BY 优化"
:
{
"node_id"
:
"mysql-c140ce4a6f0a4557a3a5ce0b471fd6da"
,
"keywords"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
"分页查询优化"
:
{
"node_id"
:
"mysql-6e063c40f1ba485288eba2376097b79c"
,
"keywords"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
"GROUP BY优化"
:
{
"node_id"
:
"mysql-66fc4566eaf34994b072ca83bf79ceb4"
,
"keywords"
:
[
"performance"
,
"优化"
,
"group by"
],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
{
" SHOW STATUS"
:
{
" SHOW STATUS"
:
{
"node_id"
:
"mysql-3574b2e5c9ca475789d9d582d7726906"
,
"node_id"
:
"mysql-3574b2e5c9ca475789d9d582d7726906"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录