Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_mysql
提交
9d06ce74
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看板
提交
9d06ce74
编写于
6月 07, 2022
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mistakes fixed
上级
5568288c
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
273 addition
and
85 deletion
+273
-85
data/2.MySQL中阶/4.子查询/6. 列子查询/in_column.md
data/2.MySQL中阶/4.子查询/6. 列子查询/in_column.md
+39
-4
data/2.MySQL中阶/9.用户和权限/3.查看用户权限/view_privileges.md
data/2.MySQL中阶/9.用户和权限/3.查看用户权限/view_privileges.md
+29
-2
data/2.MySQL中阶/9.用户和权限/5.修改用户密码/change_password.md
data/2.MySQL中阶/9.用户和权限/5.修改用户密码/change_password.md
+4
-4
data/3.MySQL高阶/1.深入索引/10.JSON索引/config.json
data/3.MySQL高阶/1.深入索引/10.JSON索引/config.json
+0
-10
data/3.MySQL高阶/1.深入索引/10.全文索引/config.json
data/3.MySQL高阶/1.深入索引/10.全文索引/config.json
+7
-2
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.json
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.json
+8
-0
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.md
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.md
+40
-0
data/3.MySQL高阶/1.深入索引/11.隐藏索引/config.json
data/3.MySQL高阶/1.深入索引/11.隐藏索引/config.json
+3
-1
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.json
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.json
+8
-0
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.md
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.md
+66
-0
data/3.MySQL高阶/1.深入索引/12.函数索引/config.json
data/3.MySQL高阶/1.深入索引/12.函数索引/config.json
+0
-0
data/3.MySQL高阶/1.深入索引/8.NULL/config.json
data/3.MySQL高阶/1.深入索引/8.NULL/config.json
+0
-10
data/3.MySQL高阶/1.深入索引/8.组合索引/config.json
data/3.MySQL高阶/1.深入索引/8.组合索引/config.json
+0
-0
data/3.MySQL高阶/1.深入索引/9.LIKE/config.json
data/3.MySQL高阶/1.深入索引/9.LIKE/config.json
+0
-10
data/3.MySQL高阶/1.深入索引/9.空间索引/config.json
data/3.MySQL高阶/1.深入索引/9.空间索引/config.json
+5
-2
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.json
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.json
+8
-0
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.md
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.md
+48
-0
data/tree.json
data/tree.json
+8
-40
未找到文件。
data/2.MySQL中阶/4.子查询/6. 列子查询/in_column.md
浏览文件 @
9d06ce74
...
@@ -3,8 +3,9 @@
...
@@ -3,8 +3,9 @@
Joe 打算写一个查询,根据员工表
Joe 打算写一个查询,根据员工表
```
mysql
```
mysql
create table employee(
create table employee
id int primary key auto_increment,
(
id int primary key auto_increment,
dept varchar(256),
dept varchar(256),
name varchar(256),
name varchar(256),
post varchar(16)
post varchar(16)
...
@@ -16,7 +17,40 @@ create table employee(
...
@@ -16,7 +17,40 @@ create table employee(
## 答案
## 答案
```
mysql
```
mysql
select distinct(dept) as dept,
select distinct(dept) as dept,
(select count(*) from employee as i where i.dept=o.dept) as emp
(select count(*)
from employee as i
where i.dept = o.dept) as emp
from employee as o;
```
## 选项
### A
```
mysql
select distinct(dept) as dept,
(select count(*)
from employee as i) as emp
from employee as o;
```
### B
```
mysql
select distinct(dept) as dept,
(select count(*)
from employee
where dept = dept) as emp
from employee
```
### C
```
mysql
select dept as dept,
(select count(*)
from employee as i
where i.dept = o.dept) as emp
from employee as o
from employee as o
```
```
\ No newline at end of file
data/2.MySQL中阶/9.用户和权限/3.查看用户权限/view_privileges.md
浏览文件 @
9d06ce74
#
# 查看用户权限
\ No newline at end of file
Joe 想要查看 Fred 的 MySQL 账户
`'fred'@'%'`
的权限,他应该怎么做?
## 答案
```
mysql
show grants for fred;
```
## 选项
### A
```
mysql
select grants from fred;
```
### B
```
mysql
show privileges for fred;
```
### B
```
mysql
show privileges from fred;
```
data/2.MySQL中阶/9.用户和权限/5.修改用户密码/change_password.md
浏览文件 @
9d06ce74
# 修改口令
# 修改口令
Fred 有一个
`'fred'@'%'`
账户,但是他忘了密码,需要 Joe 帮他修改一个新口令,
Fred 有一个
名为
`'fred'@'%'`
的 MySQL 账户,但是他忘了密码,需要 Joe 帮他修改一个新口令,
Joe 准备将这个
口令初始化为 'goods123fred',并设置为登录后修改新口令。
Joe 准备将这个
账户的口令初始化为
`goods123fred`
,
Joe 应该怎么操作
?
并设置为登录后修改新口令。他应该怎么做
?
## 答案
## 答案
```
mysql
```
mysql
alter user 'fred'@'%' identified by 'goods123fred' password expire;
alter user 'fred'@'%' identified by 'goods123fred' password expire;
...
...
data/3.MySQL高阶/1.深入索引/10.JSON索引/config.json
已删除
100644 → 0
浏览文件 @
5568288c
{
"node_id"
:
"mysql-9f8881b9f30544149327af68e3007603"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/1
3
.全文索引/config.json
→
data/3.MySQL高阶/1.深入索引/1
0
.全文索引/config.json
浏览文件 @
9d06ce74
{
{
"node_id"
:
"mysql-ba3fc0140b5842bb949c591d059e3269"
,
"node_id"
:
"mysql-ba3fc0140b5842bb949c591d059e3269"
,
"keywords"
:
[
"full text index"
,
"fti"
],
"keywords"
:
[
"full text index"
,
"fti"
],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"full_text_index.json"
],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.json
0 → 100644
浏览文件 @
9d06ce74
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"full_text_index.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"42e674c6764a40eb9124b6bffb6222fa"
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/10.全文索引/full_text_index.md
0 → 100644
浏览文件 @
9d06ce74
# 全文索引
Shop 表的部分字段如下:
```
mysql
create table shop (
id int primary key auto_increment,
description varchar(8000)
-- ...
)
```
现在 Joe 要给 description 字段加上全文索引,他应该怎么做?
## 答案
```
mysql
alter table shop add fulltext(description);
```
## 选项
### A
```
mysql
alter table shop add index fulltext(description);
```
### B
```
mysql
alter table shop create fulltext(description);
```
### C
```
mysql
alter table shop alter description add fulltext(description);
```
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/1
4
.隐藏索引/config.json
→
data/3.MySQL高阶/1.深入索引/1
1
.隐藏索引/config.json
浏览文件 @
9d06ce74
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
"node_id"
:
"mysql-c57e1195b0914cd38798ce029156ec87"
,
"node_id"
:
"mysql-c57e1195b0914cd38798ce029156ec87"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"invisible.json"
],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
0
...
...
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.json
0 → 100644
浏览文件 @
9d06ce74
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"invisible.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"07a6f3f1f98d49249a2ba14fae5a4cad"
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/11.隐藏索引/invisible.md
0 → 100644
浏览文件 @
9d06ce74
# 隐藏索引
Shop 表的部分字段如下:
```
mysql
create table shop (
id int primary key auto_increment,
description varchar(8000),
fulltext (description)
-- ...
)
```
已知 description 字段上的全文索引名为 description。因为这个表已经很大,Joe
想要删掉这个索引,但是他不确定是否有程序还在使用它,
Joe 应该怎么做?
## 答案
先执行
```
mysql
alter table shop alter index description invisible ;
```
将索引隐藏,观察确认没有影响后再执行
```
mysql
alter table shop drop index description;
```
删除。
## 选项
### A
先备份 shop 表,然后执行
```
mysql
alter table shop drop index description;
```
删除,有问题的话从备份文件恢复。
### B
备份 shop ,然后删除重建,重建时去掉 description 相关的索引逻辑。
### C
先执行
```
mysql
alter table shop alter index description invisible ;
```
将索引隐藏,确认后再执行
```
mysql
alter table shop alter index description visible ;
```
恢复索引可见。
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/1
5
.函数索引/config.json
→
data/3.MySQL高阶/1.深入索引/1
2
.函数索引/config.json
浏览文件 @
9d06ce74
文件已移动
data/3.MySQL高阶/1.深入索引/8.NULL/config.json
已删除
100644 → 0
浏览文件 @
5568288c
{
"node_id"
:
"mysql-cc8d1f5fa1e74b6bac93488149c5845f"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/
11
.组合索引/config.json
→
data/3.MySQL高阶/1.深入索引/
8
.组合索引/config.json
浏览文件 @
9d06ce74
文件已移动
data/3.MySQL高阶/1.深入索引/9.LIKE/config.json
已删除
100644 → 0
浏览文件 @
5568288c
{
"node_id"
:
"mysql-387801d5a5124f78a7bf3d68f3618a57"
,
"keywords"
:
[
"like"
],
"children"
:
[],
"export"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/
12
.空间索引/config.json
→
data/3.MySQL高阶/1.深入索引/
9
.空间索引/config.json
浏览文件 @
9d06ce74
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
"node_id"
:
"mysql-2f417818ad3449268396157cbb9d4d9c"
,
"node_id"
:
"mysql-2f417818ad3449268396157cbb9d4d9c"
,
"keywords"
:
[],
"keywords"
:
[],
"children"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"geo_index.json"
],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
2
}
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.json
0 → 100644
浏览文件 @
9d06ce74
{
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"source"
:
"geo_index.md"
,
"notebook_enable"
:
false
,
"exercise_id"
:
"4ff8589a210e4ed2bf20aba25082e04a"
}
\ No newline at end of file
data/3.MySQL高阶/1.深入索引/9.空间索引/geo_index.md
0 → 100644
浏览文件 @
9d06ce74
# 几何索引
Goods 数据库中有一个 shop 表,其中包含如下字段:
```
mysql
create table shop (
id int primary key auto_increment,
location GEOMETRY
-- ...
)
```
现在 Joe 要给 location 字段加上几何索引,他应该怎么做?
## 答案
```
mysql
alter table shop modify location GEOMETRY not null;
alter table shop add INDEX geo_index(location);
```
## 选项
### A
```
mysql
alter table shop add INDEX geo_index(location);
```
### B
```
mysql
alter table shop add INDEX location;
```
### C
```
mysql
alter table shop modify location GEOMETRY not null;
alter table shop add INDEX location;
```
### D
```
mysql
alter table shop modify location GEOMETRY not null;
alter table shop add INDEX location;
```
data/tree.json
浏览文件 @
9d06ce74
...
@@ -1349,7 +1349,7 @@
...
@@ -1349,7 +1349,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1359,7 +1359,7 @@
...
@@ -1359,7 +1359,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1369,7 +1369,7 @@
...
@@ -1369,7 +1369,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1381,7 +1381,7 @@
...
@@ -1381,7 +1381,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1391,7 +1391,7 @@
...
@@ -1391,7 +1391,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1401,7 +1401,7 @@
...
@@ -1401,7 +1401,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
1
}
}
},
},
{
{
...
@@ -1414,7 +1414,7 @@
...
@@ -1414,7 +1414,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
2
}
}
}
}
],
],
...
@@ -1522,38 +1522,6 @@
...
@@ -1522,38 +1522,6 @@
"group"
:
0
"group"
:
0
}
}
},
},
{
"NULL"
:
{
"node_id"
:
"mysql-cc8d1f5fa1e74b6bac93488149c5845f"
,
"keywords"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
"LIKE"
:
{
"node_id"
:
"mysql-387801d5a5124f78a7bf3d68f3618a57"
,
"keywords"
:
[
"like"
],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
"JSON索引"
:
{
"node_id"
:
"mysql-9f8881b9f30544149327af68e3007603"
,
"keywords"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
}
},
{
{
"组合索引"
:
{
"组合索引"
:
{
"node_id"
:
"mysql-ce1f863b4d254d2aadb6ce2331122d16"
,
"node_id"
:
"mysql-ce1f863b4d254d2aadb6ce2331122d16"
,
...
@@ -1573,7 +1541,7 @@
...
@@ -1573,7 +1541,7 @@
"children"
:
[],
"children"
:
[],
"keywords_must"
:
[],
"keywords_must"
:
[],
"keywords_forbid"
:
[],
"keywords_forbid"
:
[],
"group"
:
0
"group"
:
2
}
}
},
},
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录