提交 f5593648 编写于 作者: M Mars Liu

functions

上级 5dec1792
{ {
"node_id": "mysql-8e971f3c569a4e56bb83b5d75a2a425f", "node_id": "mysql-8e971f3c569a4e56bb83b5d75a2a425f",
"keywords": [], "keywords": ["MySQL", "关系型数据库"],
"children": [], "children": [],
"export": [ "export": [
"relation.json" "relation.json"
......
{ {
"node_id": "mysql-401a4084d56c4123afa3ced3aa0e5e98", "node_id": "mysql-401a4084d56c4123afa3ced3aa0e5e98",
"keywords": [], "keywords": ["数据库", "encode", "characterset"],
"children": [], "children": [],
"export": [ "export": [
"encode.json" "encode.json"
......
{ {
"node_id": "mysql-1418d1a710ab4e7c8cacb0bad047179e", "node_id": "mysql-1418d1a710ab4e7c8cacb0bad047179e",
"keywords": [], "keywords": [
"数值",
"int",
"long",
"float",
"double",
"decimal"
],
"children": [], "children": [],
"export": [ "export": [
"numbers.json" "numbers.json"
], ],
"keywords_must": [ "keywords_must": [
["mysql", "数值类型"] [
"mysql",
"数值类型"
]
], ],
"keywords_forbid": [], "keywords_forbid": [],
"group": 1 "group": 1
......
{ {
"node_id": "mysql-7256fe88bcf241d486c9e2e254ef66d9", "node_id": "mysql-7256fe88bcf241d486c9e2e254ef66d9",
"keywords": [], "keywords": ["date", "time", "timestamp"],
"children": [], "children": [],
"export": [ "export": [
"datetime.json" "datetime.json"
......
{ {
"node_id": "mysql-fcca525ab0f04f16834ded9b2b3f38a4", "node_id": "mysql-fcca525ab0f04f16834ded9b2b3f38a4",
"keywords": [], "keywords": ["insert", "插入"],
"children": [], "children": [],
"export": [ "export": [
"insert.json" "insert.json"
......
{ {
"node_id": "mysql-2eb9e9d351e848f580b70cf9e7b93280", "node_id": "mysql-2eb9e9d351e848f580b70cf9e7b93280",
"keywords": [], "keywords": ["update"],
"children": [], "children": [],
"export": [ "export": [
"update.json" "update.json"
......
{ {
"node_id": "mysql-3cae643e21644d6d937d69b59014922f", "node_id": "mysql-3cae643e21644d6d937d69b59014922f",
"keywords": [], "keywords": ["delete"],
"children": [], "children": [],
"export": [ "export": [
"delete.json" "delete.json"
......
{ {
"node_id": "mysql-91cc9c73e58945d3ba654370a057a1c7", "node_id": "mysql-91cc9c73e58945d3ba654370a057a1c7",
"keywords": [], "keywords": ["查询", "select", "where"],
"children": [], "children": [],
"export": [ "export": [
"where.json" "where.json"
......
{ {
"node_id": "mysql-07b85d4c87c84a62a9b55299250cd9a3", "node_id": "mysql-07b85d4c87c84a62a9b55299250cd9a3",
"keywords": [], "keywords": ["function", "procedure", "函数", "存储过程"],
"children": [], "children": [],
"export": [ "export": [
"prodandfunc.json" "prodandfunc.json"
......
{ {
"node_id": "mysql-a4998d140f024982989ed4647c78ba65", "node_id": "mysql-a4998d140f024982989ed4647c78ba65",
"keywords": [], "keywords": ["备份", "mysqldump"],
"children": [], "children": [],
"export": [ "export": [
"mysqldump.json" "mysqldump.json"
......
{ {
"node_id": "mysql-d9cdafd993bf41bbb860e5087dd54bd1", "node_id": "mysql-d9cdafd993bf41bbb860e5087dd54bd1",
"keywords": [], "keywords": ["mysqlcheck"],
"children": [], "children": [],
"export": [ "export": [
"mysqlcheck.json" "mysqlcheck.json"
......
{ {
"node_id": "mysql-c5b92946b8824ceea97b20f26946bb76", "node_id": "mysql-c5b92946b8824ceea97b20f26946bb76",
"keywords": [], "keywords": ["mysqlpump"],
"children": [], "children": [],
"export": [ "export": [
"mysqlpump.json" "mysqlpump.json"
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "mysql-0f0cd6ec82e343db95ed800a7d964cfc", "node_id": "mysql-0f0cd6ec82e343db95ed800a7d964cfc",
"keywords": [ "keywords": [
"表", "表",
"table" "table",
"自增字段",
"auto_increment"
], ],
"children": [], "children": [],
"export": [ "export": [
......
{ {
"node_id": "mysql-98e926730d844f238dc9cd8ac5f65126", "node_id": "mysql-98e926730d844f238dc9cd8ac5f65126",
"keywords": [ "keywords": [
"view" "view",
"视图"
], ],
"children": [], "children": [],
"export": [ "export": [
......
{ {
"keywords": [ "keywords": [
"produce", "produce",
"function" "function",
"函数",
"存储过程"
], ],
"children": [], "children": [],
"export": [], "export": [
"create_function.json",
"create_procedure.json",
"drop_function.json"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [ "keywords_forbid": [
["mysql", "存储过程", "函数"] [
"mysql",
"存储过程",
"函数"
]
], ],
"group": 0, "group": 2,
"node_id": "mysql-38fbee06f03c4265903345cae13996c1" "node_id": "mysql-38fbee06f03c4265903345cae13996c1"
} }
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "create_function.md",
"notebook_enable": false,
"exercise_id": "2253c23fd6fd4f4bb159565a7bf94773"
}
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "create_function.md",
"notebook_enable": false,
"exercise_id": "213471661dd244f58bd0d2e0928a0100"
}
\ No newline at end of file
# 计税
每月生成工资单时,Joe 需要根据 employee 表的 salary 字段,计算出每个员工的所得税和税后工资,
因此他决定写一个 individual_income_tax 函数,根据睡前工资计算税额。不考虑实现逻辑,这个函数的声明应该是:
## 答案
```mysql
create function individual_income_tax(salary decimal(12, 4)) returns decimal(12, 4)
deterministic
begin
-- ...
end;
```
## 选项
### A
```mysql
create store function individual_income_tax(salary decimal(12, 4)) returns decimal(12, 4)
deterministic
begin
-- ...
end;
```
### B
```mysql
create function individual_income_tax(salary decimal(12, 4))
deterministic
begin
-- ...
end;
```
### C
```mysql
create function decimal(12, 4) individual_income_tax(salary decimal(12, 4))
begin
-- ...
end;
```
{
"type": "code_options",
"author": "ccat",
"source": "create_procedure.md",
"notebook_enable": false,
"exercise_id": "16634dd1d7dc42e7a4bfaa19f457eb7b"
}
\ No newline at end of file
# 创建存储过程
计算个人所得税的函数 individual_income_tax 很好用,但是每次要保存税额和税后工资,
Joe 希望这个计算更紧凑一些,在已经有 individual_income_tax 的前提下,Joe 决定
写一个存储过程 sp_idt ,同时生成所得税和税后工资。这个存储过程的声明应该是:
## 答案
```mysql
create procedure sp_idt(in salary decimal(12, 4), out tax decimal(12, 4), out take_home decimal(12, 4))
begin
set tax = individual_income_tax(salary);
set take_home = salary - tax;
end;
```
## 选项
### A
```mysql
create procedure sp_idt(salary decimal(12, 4)) returns (tax decimal(12, 4), take_home decimal(12, 4))
begin
set tax = individual_income_tax(salary);
set take_home = salary - tax;
end;
```
### B
```mysql
create procedure sp_idt(salary decimal(12, 4)) returns (decimal(12, 4), decimal(12, 4))
begin
declare tax, take_home decimal(12, 4);
set tax = individual_income_tax(salary);
set take_home = salary - tax;
return (tax, take_home);
end;
```
### C
```mysql
create procedure sp_idt(in salary decimal(12, 4), out tax decimal(12, 4), out take_home decimal(12, 4)) returns void
begin
set tax = individual_income_tax(salary);
set take_home = salary - tax;
end;
```
### D
```mysql
create procedure sp_idt(in salary decimal(12, 4))
begin
declare tax, take_home decimal(12, 4);
set tax = individual_income_tax(salary);
set take_home = salary - tax;
select tax, take_home;
end;
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "drop_function.md",
"notebook_enable": false,
"exercise_id": "3f9a98605d244c7fa1b3e2d78b21621c"
}
\ No newline at end of file
# 删除函数
Joe 将计税逻辑放到了 sp_idt 中,现在不需要 individual_income_tax 函数了,他应该怎样删除这个函数?
## 答案
```mysql
drop function individual_income_tax;
```
## 选项
### A
```mysql
delete function individual_income_tax;
```
### B
```mysql
remove function individual_income_tax;
```
### C
```mysql
drop function individual_income_tax(decimal(12, 4));
```
{
"node_id": "mysql-e5c47aa105c5484c8871825dd622cc5e",
"keywords": [
"函数",
"锁",
"lock"
],
"children": [],
"export": [
"lock.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "lock.md",
"notebook_enable": false,
"exercise_id": "70eadd97073640d5ac486898c7294d34"
}
\ No newline at end of file
# 锁函数
关于锁函数,下列说法正确的是:
1. `GET_LOCK(value,timeout)`函数使用字符串value给定的名字获取锁,持续timeout秒。
2. 如果 `GET_LOCK` 成功获取锁,则返回1,如果获取锁超时,则返回0,如果发生错误,则返回NULL。
3. `RELEASE_LOCK(value)`函数将以value命名的锁解除。
4. 如果 `RELEASE_LOCK` 解除成功,则返回1,如果线程还没有创建锁,则返回0,如果以value命名的锁不存在,则返回NULL。
5. `IS_FREE_LOCK(value)`函数判断以value命名的锁是否可以被使用。
6. 如果`IS_FREE_LOCK`判断锁可以被使用,则返回1,如果不能使用,也就是说正在被使用,则返回0,如果发生错误,则返回NULL。
7. `IS_USED_LOCK(value)`函数判断以value命名的锁是否正在被使用,如果正在被使用,则返回使用该锁的数据库连接ID,否则返回NULL。
## 答案
全部都对
## 选项
### A
全都不对
### B
```
1, 3, 5, 7
```
### C
```
2, 4, 6
```
### D
```
7
```
### E
```
2, 3, 4
```
\ No newline at end of file
{
"node_id": "mysql-2adc9f3d02b54abc893f288140109118",
"keywords": [
"json"
],
"children": [],
"export": [
"json.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 2
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "json.md",
"notebook_enable": false,
"exercise_id": "4799f77515b748fe81494c024023efa7"
}
\ No newline at end of file
# JSON
关于 MySQL 的 JSON 操作,以下说法正确的是:
1. `JSON_CONTAINS(json_doc,value)`函数查询JSON类型的字段中是否包含value数据。如果包含则返回1,否则返回0。
2. `JSON_PRETTY(json_doc)`函数以优雅的格式显示JSON数据。
3. `JSON_SEARCH(json_doc ->> '$[*].key',type,value)`函数在JSON类型的字段指定的key中,查找字符串value。如果找到value值,则返回索引数据。
4. `JSON_DEPTH(json_doc)`函数返回JSON数据的最大深度。
5. `JSON_LENGTH(json_doc[,path])`函数返回JSON数据的长度。
6. `JSON_KEYS(json_doc[,path])`函数返回JSON数据中顶层key组成的JSON数组。
7. `JSON_INSERT(json_doc,path,val[,path,val] ...)`函数用于向JSON数据中插入数据。
8. `JSON_REMOVE(json_doc,path[,path] ...)`函数用于移除JSON数据中指定key的数据。
9. `JSON_REPLACE(json_doc,path,val[,path,val] ...)`函数用于更新JSON数据中指定Key的数据。
10. `JSON_SET(json_doc,path,val[,path,val] ...)`函数用于向JSON数据中插入数据。
11. `JSON_TYPE(json_val)`函数用于返回JSON数据的JSON类型。
12. `JSON_VALID(value)`函数用于判断value的值是否是有效的JSON数据,如果是,则返回1,否则返回0,如果value的值为NULL,则返回NULL。
## 答案
全部都对
## 选项
### A
全都不对
### C
```
1, 2, 3, 4, 5
```
### D
```
11, 12
```
\ No newline at end of file
{
"node_id": "mysql-5ccb985581644784ae82118849bc241c",
"keywords": [
"window function",
"窗口函数"
],
"children": [],
"export": [
"head.json",
"rank.json",
"within.json",
"distrubute.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 2
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "distribute.md",
"notebook_enable": false,
"exercise_id": "70eadd97073640d5ac486898c7294d34"
}
\ No newline at end of file
{
"type": "code_options",
"author": null,
"source": "distrubute.md",
"notebook_enable": false,
"exercise_id": "815be880ae8141f9b562638e167dcedb"
}
\ No newline at end of file
# 分布函数
关于分布函数,以下说法正确的是
1. `PERCENT_RANK()`函数是等级值百分比函数。
2. `CUME_DIST()`函数主要用于查询小于或等于某个值的比例
3. `PERCENT_RANK() `按照 ` (rank - 1) / (rows - 1)` 计算, 其中,rank的值为使用RANK()函数产生的序号,rows的值为当前窗口的总记录数。
## 答案
全部都对
## 选项
### A
```
1, 2
```
### B
```
2, 3
```
### C
全都不对
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "head.md",
"notebook_enable": false,
"exercise_id": "7a690485f1cc49b1968b1f8cc3ff71bd"
}
\ No newline at end of file
# 首尾
关于 window function 的首尾操作,以下说法正确的是:
1. FIRST_VALUE(expr)函数返回第一个expr的值。
2. LAST_VALUE(expr)函数返回最后一个expr的值。
## 答案
全部都对
## 选项
### A
全都不对
### C
1
### D
2
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "rank.md",
"notebook_enable": false,
"exercise_id": "660b68ab2651450ba2572c03221ca2c9"
}
\ No newline at end of file
# RANK
关于 window function 的序号操作,以下说法正确的是:
1. `ROW_NUMBER()`函数能够对数据中的序号进行顺序显示。
2. 使用`RANK()`函数能够对序号进行并列排序,并且会跳过重复的序号
3. `DENSE_RANK()`函数对序号进行并列排序,并且不会跳过重复的序号
4. `RANK()` 函数可能输出形如 `1, 2, 2, 4` 的数列
5. `DNSE_RANK()` 函数可能输出形如 `1, 2, 2, 3` 的数列
## 答案
以上都对
## 选项
### A
以上都不对
### B
```
1, 2, 3
```
### C
```
4, 5
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "within.md",
"notebook_enable": false,
"exercise_id": "94fe246370d3454a8e57c9fd8a44c59b"
}
\ No newline at end of file
# 向前和向后
关于向前和向后取值,以下说法正确的是:
1. `LAG(expr,n)`函数返回当前行的前n行的expr的值。
2. `LEAD(expr,n)`函数返回当前行的后n行的expr的值。
## 答案
全部都对
## 选项
### A
全都不对
### C
1
### D
2
\ No newline at end of file
{
"node_id": "mysql-a7006c27131d4b87817a59717db7021c",
"keywords": [
"datetime",
"timestame",
"date",
"time",
"year",
"month",
"day",
"hour",
"minute",
"second",
"microsecond"
],
"children": [],
"export": [
"day.json",
"curtime.json",
"weekofyear.json",
"weekday.json",
"to_days.json",
"now.json",
"extract.json",
"timestamp.json",
"from_days.json",
"make.json",
"date.json",
"dt_format.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "curtime.md",
"notebook_enable": false,
"exercise_id": "bc88844a66244492947e98da40709619"
}
\ No newline at end of file
# 当前时间
Joe 需要在程序中获取当前时间,但是不包含日期部分。下列哪些函数可以提供这个功能?
1. now()
2. curtime()
3. sysdate()
4. current_time()
5. current_timestamp()
## 答案
```
2, 4
```
## 选项
### A
```
1, 2, 3, 4
```
### B
全都可以
### C
全部都错
### D
```
4, 5
```
### E
```
1, 2
```
{
"type": "code_options",
"author": "ccat",
"source": "date.md",
"notebook_enable": false,
"exercise_id": "68f35847b5194ba3addf120d6ed5ecb6"
}
\ No newline at end of file
# 日期时间计算
以下关于时间和日期数据计算的知识,哪些是正确的?
1. `ADDTIME(time1,time2)`函数返回time1加上time2的时间。其中,time2是一个表达式,也可以是一个数字,当time2为一个数字时,代表的是秒。
2. `SUBTIME(time1,time2)`函数返回time1减去time2后的时间。其中,time2是一个表达式,也可以是一个数字,当time2为一个数字时,代表的是秒。
3. `DATE_ADD(date,INTERVAL expr type)`函数返回与date加上INTERVAL时间间隔的日期。Type 与 extract 参数中毫秒之外的部分相同。
4. `DATE_SUB(date,INTERVAL expr type)`函数返回与date减去INTERVAL时间间隔的日期。Type 与 extract 参数中毫秒之外的部分相同。
5. `DATEDIFF(date1,date2)` 函数计算两个日期之间相差的天数。
6. `PERIOD_ADD(time,n)`函数返回time加上n后的时间。
## 答案
全部都对
## 选项
### A
全都不对
### B
```
1, 2, 3, 4
```
### C
```
2, 3, 4, 5
```
### D
```
4, 5
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "day.md",
"notebook_enable": false,
"exercise_id": "b64ebf99bff14f69b2ef92049bb7b57c"
}
\ No newline at end of file
# DAY
Joe 需要从日期中提取当天是几号,下列哪些函数可以实现这个功能?
1. DAY
2. DAYOFMONTH
3. DAYOFYEAR
4. TO_DAYS
## 答案
1 和 2
## 选项
### A
只有 1
### B
只有 2
### C
都不对
### D
全都可以
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "dt_format.md",
"notebook_enable": false,
"exercise_id": "1aaf7a00feb04d0b82afa1a0574d5719"
}
\ No newline at end of file
# 格式化
关于日期时间数据的格式化,以下说法正确的是:
1. `DATE_FORMAT(date,format)`函数按照指定的格式format来格式化日期date。
2. `TIME_FORMAT(time,format)`函数按照指定的格式format来格式化日期date。
3. `GET_FORMAT(date_type,format_type)`函数返回日期字符串的显示格式,其中date_type表示日期类型,format_type表示格式化类型。
## 答案
全部都对
## 选项
### A
```
1, 2
```
### B
```
2, 3
```
### C
全都不对
### D
```
1, 3
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "extract.md",
"notebook_enable": false,
"exercise_id": "73635de953474af4aa1af6cd90dc8129"
}
\ No newline at end of file
# EXTRACT
关于 Extract 操作和其它日期时间函数的对应关系,下列说法正确的是:
1. `extract(mirosecond from date)` 相当于 `ms(date)`
2. `extract(second from date)` 相当于 `second(date)`
3. `extract(minute from date)` 相当于 `minute(date)`
4. `extract(hour from date)` 相当于 `hour(date)`
5. `extract(day from date)` 相当于 `day(date)`
6. `extract(week from date)` 相当于 `week(date)`
7. `extract(month from date)` 相当于 `month(date)`
8. `extract(quarter from date)` 相当于 `quarter(date)`
9. `extract(year from date)` 相当于 `year(date)`
## 答案
```
2, 3, 4, 5, 6, 7, 8, 9
```
## 选项
### A
全部都对
### B
```
1, 2, 3, 4
```
### C
全都不对
### D
```
5, 6, 7, 8, 9
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "from_days.md",
"notebook_enable": false,
"exercise_id": "cda783def29f4431979121e05498690c"
}
\ No newline at end of file
# FROM_DAYS
FROM_DAYS 函数返回的是?
## 答案
给定从 0000 年 1 月 1 日起的天数,返回对应的日期
## 选项
### A
给定从 1970 年 1 月 1 日起的天数,返回对应的日期
### B
都不对
### C
给定从当前日期算起的天数,返回对应的日期
{
"type": "code_options",
"author": "ccat",
"source": "make.md",
"notebook_enable": false,
"exercise_id": "d4f49d310b1440aabdc81cf7cd020aa7"
}
\ No newline at end of file
# MAKE DATE AND TIME
关于日期时间构造方法,下面说法正确的是:
1. `MAKETIME(hour,minute,second)`函数将给定的小时、分钟和秒组合成时间并返回。
2. `MAKEDATE(year,n)`函数针对给定年份与所在年份中的天数返回一个日期。
3. `LAST_DAY(date)`函数返回date所在月份的最后一天的日期。
4. `TIME_TO_SEC(time)`函数将time的时分秒部分转化为秒并返回结果值。
5. `SEC_TO_TIME(seconds)`函数将seconds描述转化为包含小时、分钟和秒的时间。
## 答案
全部都对
## 选项
### A
```
1, 2, 3
```
### B
```
4, 5
```
### C
全都不对
### D
```
2, 3, 4
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "now.md",
"notebook_enable": false,
"exercise_id": "f628db00fb904159a301551adc981d78"
}
\ No newline at end of file
# 当前时间
Joe 在程序中获取当前时间,下面哪个函数*不*能满足要求?
1. now()
2. sysdate()
3. CURRENT_TIMESTAMP()
4. LOCALTIME()
5. current()
## 答案
5
## 选项
### A
1
### B
2
### C
3
### D
4
{
"type": "code_options",
"author": "ccat",
"source": "timestamp.md",
"notebook_enable": false,
"exercise_id": "680153b527564dffaa026c8130e388f3"
}
\ No newline at end of file
# TIMESTAMP
关于 UNIX 时间戳和 MySQL 的日期时间类型,以下说法正确的是:
1. UNIX_TIMESTAMP(date) 函数将 date 转换为 UNIX 时间戳
2. FROM_UNIXTIME(timestamp) 将 UNIX 时间戳 timestamp 转换为 date 类型
3. extract(timestamp from date) 可以将 date 转换为 Unix 时间戳
4. extract(datetime from timestamp) 可以将时间戳转换为 datetime
## 答案
```
1, 2
```
## 选项
### A
全部都对
### B
全都不对
### C
```
3, 4
```
{
"type": "code_options",
"author": "ccat",
"source": "to_days.md",
"notebook_enable": false,
"exercise_id": "c48b730d0d0f4347969e1c9375efd3c1"
}
\ No newline at end of file
# TO_DAYS
TO_DAYS 函数返回的是?
## 答案
给定时间到 0000 年 1 月 1 日的天数。
## 选项
### A
给定时间到 1970 年 1 月 1 日的天数。
### B
都不对
### C
当前时间到 0000 年 1 月 1 日的天数。
### D
当前时间到 1970 年 1 月 1 日的天数。
{
"type": "code_options",
"author": "ccat",
"source": "weekday.md",
"notebook_enable": false,
"exercise_id": "92dc6edd3bbb43969147763a3298bbea"
}
\ No newline at end of file
# WeekDay
Joe 想要用 weekday 生成每周分析报表,这个函数会将如期映射为整数,当 weekday 返回 0 ,代表周几?
## 答案
周一
## 选项
### A
周日
### B
周六
### C
全都不是
### D
视时区不同而变
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "now.md",
"notebook_enable": false,
"exercise_id": "5ef9bfa0d9b34219941e4b833fa54e77"
}
\ No newline at end of file
# WEEK OF YEAR
下列函数中,哪些可以获取给定时间在一年中的第几周?
1. week
2. weekofyear
3. weekday
4. dayofyear
5. dayofweek
## 答案
```
1, 2
```
## 选项
### A
```
1, 2, 3, 4
```
### B
全部都是
### C
全都不是
### D
```
1, 2, 3, 5
```
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "cast.md",
"notebook_enable": false,
"exercise_id": "256bc41fc10f4d33b18219b4b97aa46a"
}
\ No newline at end of file
# 类型转换
Joe 想要把字符串表示的整数转为整数类型,可行的方法是:
## 答案
```mysql
SELECT CAST('123' AS SIGNED);
```
## 选项
### A
```mysql
select int('123');
```
### B
全都不对
### C
全都可以
### D
```
select signed('123');
```
### E
```
SELECT CAST('123' AS INT);
```
{
"node_id": "mysql-df29b082d5364530b95bbdc14adc107e",
"keywords": [
"函数",
"cast"
],
"children": [],
"export": [
"cast.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
...@@ -39,7 +39,10 @@ ...@@ -39,7 +39,10 @@
{ {
"数据库基本概念": { "数据库基本概念": {
"node_id": "mysql-8e971f3c569a4e56bb83b5d75a2a425f", "node_id": "mysql-8e971f3c569a4e56bb83b5d75a2a425f",
"keywords": [], "keywords": [
"MySQL",
"关系型数据库"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -155,7 +158,11 @@ ...@@ -155,7 +158,11 @@
{ {
"数据库编码": { "数据库编码": {
"node_id": "mysql-401a4084d56c4123afa3ced3aa0e5e98", "node_id": "mysql-401a4084d56c4123afa3ced3aa0e5e98",
"keywords": [], "keywords": [
"数据库",
"encode",
"characterset"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -199,7 +206,14 @@ ...@@ -199,7 +206,14 @@
{ {
"数值类型": { "数值类型": {
"node_id": "mysql-1418d1a710ab4e7c8cacb0bad047179e", "node_id": "mysql-1418d1a710ab4e7c8cacb0bad047179e",
"keywords": [], "keywords": [
"数值",
"int",
"long",
"float",
"double",
"decimal"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -214,7 +228,11 @@ ...@@ -214,7 +228,11 @@
{ {
"日期和时间类型": { "日期和时间类型": {
"node_id": "mysql-7256fe88bcf241d486c9e2e254ef66d9", "node_id": "mysql-7256fe88bcf241d486c9e2e254ef66d9",
"keywords": [], "keywords": [
"date",
"time",
"timestamp"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -286,7 +304,10 @@ ...@@ -286,7 +304,10 @@
{ {
"插入": { "插入": {
"node_id": "mysql-fcca525ab0f04f16834ded9b2b3f38a4", "node_id": "mysql-fcca525ab0f04f16834ded9b2b3f38a4",
"keywords": [], "keywords": [
"insert",
"插入"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -301,7 +322,9 @@ ...@@ -301,7 +322,9 @@
{ {
"修改": { "修改": {
"node_id": "mysql-2eb9e9d351e848f580b70cf9e7b93280", "node_id": "mysql-2eb9e9d351e848f580b70cf9e7b93280",
"keywords": [], "keywords": [
"update"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -316,7 +339,9 @@ ...@@ -316,7 +339,9 @@
{ {
"删除": { "删除": {
"node_id": "mysql-3cae643e21644d6d937d69b59014922f", "node_id": "mysql-3cae643e21644d6d937d69b59014922f",
"keywords": [], "keywords": [
"delete"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -360,7 +385,11 @@ ...@@ -360,7 +385,11 @@
{ {
"WHERE": { "WHERE": {
"node_id": "mysql-91cc9c73e58945d3ba654370a057a1c7", "node_id": "mysql-91cc9c73e58945d3ba654370a057a1c7",
"keywords": [], "keywords": [
"查询",
"select",
"where"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -393,7 +422,12 @@ ...@@ -393,7 +422,12 @@
{ {
"函数": { "函数": {
"node_id": "mysql-07b85d4c87c84a62a9b55299250cd9a3", "node_id": "mysql-07b85d4c87c84a62a9b55299250cd9a3",
"keywords": [], "keywords": [
"function",
"procedure",
"函数",
"存储过程"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
[ [
...@@ -484,7 +518,10 @@ ...@@ -484,7 +518,10 @@
{ {
"mysqldump": { "mysqldump": {
"node_id": "mysql-a4998d140f024982989ed4647c78ba65", "node_id": "mysql-a4998d140f024982989ed4647c78ba65",
"keywords": [], "keywords": [
"备份",
"mysqldump"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
"mysqldump" "mysqldump"
...@@ -496,7 +533,9 @@ ...@@ -496,7 +533,9 @@
{ {
"mysqlcheck": { "mysqlcheck": {
"node_id": "mysql-d9cdafd993bf41bbb860e5087dd54bd1", "node_id": "mysql-d9cdafd993bf41bbb860e5087dd54bd1",
"keywords": [], "keywords": [
"mysqlcheck"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
"mysqlcheck" "mysqlcheck"
...@@ -520,7 +559,9 @@ ...@@ -520,7 +559,9 @@
{ {
"mysqlpump": { "mysqlpump": {
"node_id": "mysql-c5b92946b8824ceea97b20f26946bb76", "node_id": "mysql-c5b92946b8824ceea97b20f26946bb76",
"keywords": [], "keywords": [
"mysqlpump"
],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
"mysqlpump" "mysqlpump"
...@@ -573,7 +614,9 @@ ...@@ -573,7 +614,9 @@
"node_id": "mysql-0f0cd6ec82e343db95ed800a7d964cfc", "node_id": "mysql-0f0cd6ec82e343db95ed800a7d964cfc",
"keywords": [ "keywords": [
"表", "表",
"table" "table",
"自增字段",
"auto_increment"
], ],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
...@@ -590,7 +633,8 @@ ...@@ -590,7 +633,8 @@
"视图": { "视图": {
"node_id": "mysql-98e926730d844f238dc9cd8ac5f65126", "node_id": "mysql-98e926730d844f238dc9cd8ac5f65126",
"keywords": [ "keywords": [
"view" "view",
"视图"
], ],
"children": [], "children": [],
"keywords_must": [ "keywords_must": [
...@@ -608,7 +652,9 @@ ...@@ -608,7 +652,9 @@
"node_id": "mysql-38fbee06f03c4265903345cae13996c1", "node_id": "mysql-38fbee06f03c4265903345cae13996c1",
"keywords": [ "keywords": [
"produce", "produce",
"function" "function",
"函数",
"存储过程"
], ],
"children": [], "children": [],
"keywords_must": [], "keywords_must": [],
...@@ -619,7 +665,7 @@ ...@@ -619,7 +665,7 @@
"函数" "函数"
] ]
], ],
"group": 0 "group": 2
} }
}, },
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册