difference between union and union all

UNIONĀ 

Union gives distinct records or entries from all table.

SELECT dbA, dbB FROM tbl1
UNION
SELECT dbA, dbB FROM tbl2

UNION ALL

Union All gives all records from tbl1 and tbl2

SELECT dbA, dbB FROM tbl1
UNION ALL
SELECT dbA, dbB FROM tbl2

 

Leave a Reply

Protected with IP Blacklist CloudIP Blacklist Cloud

Unable to load the Are You a Human PlayThru™. Please contact the site owner to report the problem.