提交 99f28cbb 编写于 作者: M Mars Liu

convert

上级 4b202716
......@@ -2,11 +2,13 @@
"node_id": "mysql-df29b082d5364530b95bbdc14adc107e",
"keywords": [
"函数",
"cast"
"cast",
"convert"
],
"children": [],
"export": [
"cast.json"
"cast.json",
"convert.json"
],
"keywords_must": [],
"keywords_forbid": [],
......
{
"type": "code_options",
"author": "ccat",
"source": "convert.md",
"notebook_enable": false,
"exercise_id": "a152ea2ab0c5410fa2d2b808afd063ae"
}
\ No newline at end of file
# 编码转换
Joe 需要将下面这个查询
```mysql
select name from goods;
```
中的 name 字段的字符集改为 gb 18030,他应该怎么做?
## 答案
```mysql
select convert(name using 'gb18030') from goods;
```
## 选项
### A
```mysql
select str(name, 'gb18303') from goods;
```
### B
```mysql
select encode(decode(name, 'utf8mb4'), 'gb18303') from goods;
```
### C
```mysql
select convert(name from 'utf8mb4' to 'gb18303') from goods;
```
### D
```mysql
select convert(name to 'gb18303') from goods;
```
### E
所有都错
\ No newline at end of file
......@@ -958,7 +958,8 @@
"node_id": "mysql-df29b082d5364530b95bbdc14adc107e",
"keywords": [
"函数",
"cast"
"cast",
"convert"
],
"children": [],
"keywords_must": [],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册