diff --git "a/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.json" "b/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.json" new file mode 100644 index 0000000000000000000000000000000000000000..a59f68580a5ff64506cafe8657809b261f906450 --- /dev/null +++ "b/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.json" @@ -0,0 +1,5 @@ +{ + "type": "code_options", + "author": "刘鑫", + "source": "show_title.md" +} \ No newline at end of file diff --git "a/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.md" "b/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.md" new file mode 100644 index 0000000000000000000000000000000000000000..6e8186c2fc465c565d9598172e0f8604a6ad819c --- /dev/null +++ "b/data/3.OceanBase\351\253\230\351\230\266/3.\347\274\226\347\250\213\345\222\214\346\237\245\350\257\242/2.\350\277\236\346\216\245\346\237\245\350\257\242/show_title.md" @@ -0,0 +1,58 @@ +# 显示分类标题 + +假设员工表employee和部门表department中有如下列: + +```sql +create table employee( + id integer auto_increment primary key , + name varchar(256), + dept int +); + +create table department( + id integer auto_increment primary key , + name varchar(256) +) +``` + +员工表的 dept 列引用 department 表的主键。 + +那么能够显示员工列表,并展示其所在部门的名称的是: + +## 答案 + +```sql +select e.id, e.name, d.name as department +from employee as e join department as d on e.dept = d.id +``` + +## 选项 + +### 表名引用错误 + +```sql +select e.id, e.name, d.name as department +from employee as e join department as d on e.dept = d.id +``` + +### 连接条件错误 + +```sql +select e.id, e.name, e.name as department +from employee as e join department as d on e.id = d.id +``` + +### 连接条件错误 + +```sql +select e.id, e.name, e.name as department +from employee as e join department as d on e.department in d.id +``` + + +### 列名存在歧义问题 + +```sql +select e.id, name, d.name as department +from employee as e join department as d on e.dept = d.id +```