And the UNION command is similar,
INTERSECT is also two SQL statements to do the result handle. Different places, UNION is basically an OR (if this value exists in the first sentence or two in sentence, it will be chosen), and INTERSECT are more like AND (This value must exist in the first and the second one sentence will be chosen). UNION is a joint set, which is the intersection of INTERSECT
INTERSECT syntax is as follows:
[SQL Statement 1]
INTERSECT
[SQL Statement 2]
Suppose we have the following two tables,
A table
Place Price Date
Los Angeles $ 1500 Jan-05-1999
San Diego $ 250 Jan-07-1999
Los Angeles $ 300 Jan-08-1999
Boston $ 700 Jan-08-1999
Form B
Date Price
Jan-07-1999 $ 250
Jan-10-1999 $ 535
Jan-11-1999 $ 320
Jan-12-1999 $ 750
We have a few days to find out which
store transactions and online transactions. To achieve this purpose, we use the following SQL statement:
SELECT Date FROM A
INTERSECT
SELECT Date FROM B
Results:
Date
Jan-07-1999
Please note that the INTERSECT command, different values are listed only once
tiffany & co