标签:select mysql union rom pre sele mys inner dep
共有SELECT
*
FROM
t_dept a
INNER JOIN t_emp b ON a.id = b.deptId;
SELECT
*
FROM
t_dept a
LEFT JOIN t_emp b ON a.id = b.deptId;
SELECT
*
FROM
t_dept a
RIGHT JOIN t_emp b ON a.id = b.deptId;
SELECT
*
FROM
t_dept a
LEFT JOIN t_emp b ON a.id = b.deptId
WHERE b.deptId IS NULL;
SELECT
*
FROM
t_dept a
RIGHT JOIN t_emp b ON a.id = b.deptId
WHERE a.id IS NULL;
SELECT
*
FROM
t_dept a
LEFT JOIN t_emp b ON a.id = b.deptId
UNION
SELECT
*
FROM
t_dept a
RIGHT JOIN t_emp b ON a.id = b.deptId;
SELECT
*
FROM
t_dept a
LEFT JOIN t_emp b ON a.id = b.deptId
WHERE b.deptId IS NULL
UNION
SELECT
*
FROM
t_dept a
RIGHT JOIN t_emp b ON a.id = b.deptId
WHERE a.id IS NULL;
标签:select mysql union rom pre sele mys inner dep
原文地址:https://blog.51cto.com/13559120/2504351