例如,当我们使用join
时,通常有2个表员工和部门Employees.Employee_id
|Employees.Dept_id|Departments.Dept_id|Departments.Department_name|Departments.location_id|
x x x x
x x x x
x x x x
在这种情况下查询是什么。 第一个是
SELECT Employees.Employee_id,
Employees.Dept_id,
Departments.Dept_id,
Departments.Department_name,
Departments.location_id
FROM employees
FULL OUTER JOIN departments
ON Employees.Dept_id=Departments.Dept_id
第二个是什么??? Employees.Employee_id
|Employees.Dept_id|Departments.Dept_id|Departments.Department_name|Departments.location_id|
X X
x x
x x
x x x
x x x
x x x
答案 0 :(得分:0)
在评论中,您描述的是非联合联盟。像这样:
SELECT Employees.Employee_id, Employees.Dept_id, NULL, NULL, NULL
FROM employees
UNION ALL
SELECT NULL, NULL, Departments.Dept_id, Departments.Department_name, Departments.location_id
FROM departments