SQL DMLシ夊、蜷亥撫縺蜷医o縺(UNION)

讎りヲ

髮蜷域シ皮ョ怜ュ
UNION
UNION ALL
MINUS/EXCEPT
INTERSECT

繧堤畑縺縺ヲ隍謨ー縺ョ蝠上>蜷医o縺帙ョ繝シ繧ソ繧堤オ縺ソ蜷医o縺帙k蝠上>蜷医o縺

繝サ蛻励ョ謨ー縲√ョ繝シ繧ソ蝙九b蜷後§縺ァ縺ゅk蠢隕√′縺ゅk縲
窶サ繧オ繧、繧コ縲∝怜錐縺ッ驕輔▲縺ヲ縺縺ヲ繧り憶縺縲
繝サORDER BY蜿・縺ッ隍蜷亥撫縺蜷医o縺帛縺ョ譛蠕後↓1蝗槭□縺第欠螳壼庄閭ス縲
繝サ譛蛻昴ョSELECT譁縺ョ蛻怜錐縺瑚。ィ遉コ縺輔l繧九
窶サ譛蛻昴ョSELECT譁縺ョ蛻怜錐繧呈欠螳
繝サUNION ALL繧帝勁縺阪∫ャャ荳蛻励〒繧ス繝シ繝医&繧後k縲

UNION

驥崎、辟。縺
union2
SELECT * FROM 陦ィ1
UNION
SELECT * FROM 陦ィ2
窶サ陦ィ1 + 陦ィ1
邨先棡縺ッ繧ス繝シ繝縺輔l繧

UNION ALL

驥崎、譛峨j
union
SELECT * FROM 陦ィ1
UNION ALL
SELECT * FROM 陦ィ2
窶サ陦ィ1 + 陦ィ1
邨先棡縺ッ繧ス繝シ繝縺輔l縺ェ縺

MINUS/EXCEPT

蟾ョ蛻
minus

SELECT * FROM 陦ィ1
MINUS
SELECT * FROM 陦ィ2
窶サ陦ィ1 – 陦ィ2

邨先棡縺ッ繧ス繝シ繝縺輔l繧

A陦ィ
蛟、1
(NULL)
(NULL)

B陦ィ
蛟、2
(NULL)

縺ョ蝣エ蜷医、陦ィ MINUS B陦ィ縺ョ隍蜷亥撫縺蜷医o縺帷オ先棡縺ッ縲
蛟、1
窶サ(NULL)縺ッ霑斐&繧後↑縺縲(NULL)縺ッ1縺、縺ョ蛟、縺ィ縺励※謇ア繧上l繧九

SELECT * FROM 陦ィ1
EXCEPT
SELECT * FROM 陦ィ2

INTERSECT

驥崎、縺励※縺繧九Ξ繧ウ繝シ繝峨ョ縺ソ謚ス蜃コ
intersect
SELECT * FROM 陦ィ1
INTERSECT
SELECT * FROM 陦ィ1
邨先棡縺ッ繧ス繝シ繝縺輔l繧

Follow me!

蜑阪ョ險倅コ

SQL DMLシ壼憶蝠上>蜷医o縺

谺。縺ョ險倅コ

SQL DMLシ壼宛蠕。譁