Home > Database > Mysql Tutorial > How to implement INTERSECTION between tables with the help of MySQL connection?

How to implement INTERSECTION between tables with the help of MySQL connection?

王林
Release: 2023-09-05 13:57:02
forward
1263 people have browsed it

How to implement INTERSECTION between tables with the help of MySQL connection?

Actually, INTERSECTION is just an inner join of all columns. Let's take two tables as an example, the data is as follows -

mysql> Select * from value1;
+------+------+
| i    | j    |
+------+------+
| 1    | 1    |
| 2    | 2    |
+------+------+
2 rows in set (0.00 sec)

mysql> Select * from value2;
+------+------+
| i    | j    |
+------+------+
| 1    | 1    |
| 3    | 3    |
+------+------+
2 rows in set (0.00 sec)
Copy after login

Now, the following query will perform the intersection between these tables -

mysql> Select * from value1 join value2 using(i,j);
+------+------+
| i    | j    |
+------+------+
| 1    | 1    |
+------+------+
1 row in set (0.08 sec)
Copy after login

The above is the detailed content of How to implement INTERSECTION between tables with the help of MySQL connection?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template