INTERSECT is an operator.
INTERSECT return distinct rows by comparing the results
of two queries.
INTERTSECT returns distinct rows or values that are
returned by both the query on left and right sides of INTESECT operand.
Intersect Query:-
Syntax:-
Select expression1,
expression2, …. from Tbale1
INTERSECT
Select expression1,
expression2, …. from Tbale2
Note:-
1.) There
must be same number of expressions in both the tables.
2.) The
corresponding expressions must have the same data type in select statement.
Example:-
Select OrderId,Itemname from tbl_order
INTERSECT
Select PurchaseId,PurchaseName from tbl_purchase
No comments:
Post a Comment
Note: only a member of this blog may post a comment.