The union command is used to combine two or more SELECT queries, and each select statement may be used on either a single table or several tables at the same time. The primary difference between UNION and UNION ALL is that the former eliminates duplicate rows in tables when it is applied, whilst the latter keeps them. UNION removes duplicate rows when it is applied.