MySQL implements Minus and Intersect)
MySQL does not implement the Minus and Intersect functions, just as it does not implement the cube function.
You can use SQL to implement the same function, which is troublesome.
Drop table t1;
Drop table t2;
Create table t1 (id int primary key, nickname varchar (20), playNum varchar (20 ));
Create table t2 (id int primary key, nickname varchar (20), playNum varchar (20 ));
Insert into t1 values (1, 1, 10 );
Insert into t1 values (2, 2, 20 );
Insert into t1 values (3, 3, 30 );
Insert into t2 values (1, 1, 10 );
Insert into t2 values (2, 2, 200 );
Insert into t2 values (300 );
Commit;
MySQL implementation Intersection
SELECT id, nickname, playNum, COUNT (*)
FROM (SELECT id, nickname, playNum
FROM t1
UNION ALL
SELECT id, nickname, playNum
FROM t2
)
Group by id, nickname, playNum
Having count (*)> 1
MySQL implementation difference set
SELECT t1.id, t1.nickname, t1.playNum
FROM t1 left join t2 ON t1.id = t2.id
WHERE t1.nickname! = T2.nickname
OR t1.playNum! = T2.playNum;
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: