Union, Intercept, Except Flashcards
What does the Union Statement do?
The UNION keyword combines the results of two SELECT statements into a single result set, eliminating duplicate rows by default.
What defines the column
name used in the result set?
The first data set entered into SQL.
What two things must the data sets have if you want to use the union keyword?
Datasets must have the same number of columns and similar datatypes.
What’s the difference between UNION and UNION ALL?
UNION ALL UNION ALL will
leave the duplicate rows in the result set. Their queries will also execute faster because it does not check for duplicate values.
What does INTERSECT do?
The INTERSECT keyword returns distinct rows that are found in both datasets.
How many data sets can be compared with the INTERSECT keyword?
2 datasets
What does the EXCEPT keyword do?
The EXCEPT keyword returns rows from the first dataset that are not found in the second dataset