From 79a63904e65888e77514b57e249d1a4f78f8a26a Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Fri, 16 Sep 2022 15:39:26 +0800 Subject: [PATCH] fixed right join --- .../3. RIGHT JOIN/right_join.md" | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\350\277\236\346\216\245\346\237\245\350\257\242/3. RIGHT JOIN/right_join.md" "b/data/2.MySQL\344\270\255\351\230\266/6.\350\277\236\346\216\245\346\237\245\350\257\242/3. RIGHT JOIN/right_join.md" index 43ca05f..f5b6135 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/6.\350\277\236\346\216\245\346\237\245\350\257\242/3. RIGHT JOIN/right_join.md" +++ "b/data/2.MySQL\344\270\255\351\230\266/6.\350\277\236\346\216\245\346\237\245\350\257\242/3. RIGHT JOIN/right_join.md" @@ -33,9 +33,9 @@ create table employee( ## 答案 ```sql -select e.id, e.name, e.dept +select e.id, e.name, e.dept_id, d.name 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; ``` @@ -44,27 +44,27 @@ where d.id is null; ### A ```sql -select e.id, e.name, e.dept +select e.id, e.name, e.dept_id, d.name 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; ``` ### B ```sql -select e.id, e.name, e.dept +select e.id, e.name, e.dept_id, d.name 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; ``` ### C ```sql -select e.id, e.name, e.dept +select e.id, e.name, e.dept_id, d.name 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; ``` @@ -72,8 +72,8 @@ where d.id is null; ### D ```sql -select e.id, e.name, e.dept +select e.id, e.name, e.dept_id, d.name 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; ``` \ No newline at end of file -- GitLab