Javatpoint Logo
Javatpoint Logo

MariaDB INTERSECT Operator

INTERSECT Operator is used to return intersection of 2 or more tables. If a record exists in both tables, it will be included in the INTERSECT results. Otherwise, it will be omitted from the INTERSECT results.

Syntax:

Image representation

MariaDB Intersect operator 1

Note: MariaDB does not suppoort INTERSECT operator but you can see the same thing by using IN operator to simulate the INTERSECT query as follows:


Return Single Field using INTERSECT Operator

Following is a general query for INTERSECT operator but it will not be supoported in MariaDB.

Use the following one:

Output:

MariaDB Intersect operator 2

It shows only common names between both the tables "Students" and "Student".


INTERSECT Operator with WHERE Clause

Following is a general query for INTERSECT operator but it will not be supoported in MariaDB.

Use the following syntax:

Output:

MariaDB Intersect operator 3

Note: You can also use INTERSECT operator with multiple expressions.


Next TopicMariaDB Export





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA