提交 79a63904 编写于 作者: M Mars Liu

fixed right join

上级 c00f4f5a
...@@ -33,9 +33,9 @@ create table employee( ...@@ -33,9 +33,9 @@ create table employee(
## 答案 ## 答案
```sql ```sql
select e.id, e.name, e.dept select e.id, e.name, e.dept_id, d.name
from department as d from department as d
right join employee as e on d.id = e.dept right join employee as e on d.id = e.dept_id
where d.id is null; where d.id is null;
``` ```
...@@ -44,27 +44,27 @@ where d.id is null; ...@@ -44,27 +44,27 @@ where d.id is null;
### A ### A
```sql ```sql
select e.id, e.name, e.dept select e.id, e.name, e.dept_id, d.name
from employee as e from employee as e
right join department as d on d.id = e.dept right join department as d on d.id = e.dept_id
where e.id is null; where e.id is null;
``` ```
### B ### B
```sql ```sql
select e.id, e.name, e.dept select e.id, e.name, e.dept_id, d.name
from employee as e from employee as e
right join department as d on d.id = e.dept right join department as d on d.id = e.dept_id
where d.id is null; where d.id is null;
``` ```
### C ### C
```sql ```sql
select e.id, e.name, e.dept select e.id, e.name, e.dept_id, d.name
from department as d from department as d
join employee as e on d.id = e.dept join employee as e on d.id = e.dept_id
where d.id is null; where d.id is null;
``` ```
...@@ -72,8 +72,8 @@ where d.id is null; ...@@ -72,8 +72,8 @@ where d.id is null;
### D ### D
```sql ```sql
select e.id, e.name, e.dept select e.id, e.name, e.dept_id, d.name
from department as d from department as d
right join employee as e on d.id = e.dept right join employee as e on d.id = e.dept_id
where d.id is null; where d.id is null;
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册