MySQL Forums
Forum List  »  Oracle

oracle function
Posted by: green jim
Date: March 15, 2010 08:31PM

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 whichstore 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 oncetiffany & co

Options: ReplyQuote


Subject
Views
Written By
Posted
oracle function
4139
March 15, 2010 08:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.