实际上,INTERSECTION只是所有列上的内部联接。我们以两个表的简单示例为例,数据如下:
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)
现在,以下查询将在这些表之间进行相交-
mysql> Select * from value1 join value2 using(i,j); +------+------+ | i | j | +------+------+ | 1 | 1 | +------+------+ 1 row in set (0.08 sec)