INTERSECT
Function
This statement is used to return the intersection set of multiple query results.
Syntax
1
|
select_statement INTERSECT select_statement; |
Keyword
INTERSECT returns the intersection of multiple query results. The number of columns returned by each SELECT statement must be the same. The column type and column name may not be the same. By default, INTERSECT deduplication is used.
Precautions
Do not add brackets between multiple set operations, such as UNION, INTERSECT, and EXCEPT. Otherwise, an error is reported.
Example
To return the intersection set of the query results of the SELECT * FROM student _1 and SELECT * FROM student _2 commands with the repeated records removed, run the following statement:
1
|
SELECT * FROM student _1 INTERSECT SELECT * FROM student _2; |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.