UNION

SQL UNION Keyword

The UNION command combines the result sets of two or more SELECT statements into a single result set, returning only distinct values. The columns in each SELECT must have the same number of columns, in the same order, and with compatible data types.

Tutorials dojo strip

SQL UNION Syntax

SQL

SQL UNION Example

This query combines distinct gender values from Patients and distinct specialty values from Doctors as a single list.

SQL

SQL UNION Labs

Tutorials dojo strip