Selecting the union:
select * from table1
union
select * from table1_backup
What is the query to select the intersection?
Description. The SQL Server (Transact-SQL) INTERSECT operator is used to return the records that are in common between two SELECT statements or data sets. If a record exists in one query and not in the other, it will be omitted from the INTERSECT results. It is the intersection of the two SELECT statements.
Intersection table. The intersection table holds the associations between rows in the base tables of the master and detail business components. Each row in the intersection table represents one association between the two business components.
INTERSECT is not supported in every implementation of SQL, but it is the standard.
The syntax for a set operation is: <SELECT-statement> {UNION | INTERSECT | EXCEPT | MINUS} [ALL | DISTINCT] <SELECT-statement> {UNION | INTERSECT | EXCEPT | MINUS} [ALL | DISTINCT] <SELECT-statement>]* [ORDER BY …] [LIMIT …]
In SQL Server intersect
select * from table1 intersect select * from table1_backup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With