在mysql中,可以利用“SELECT”语句和“INNER JOIN”关键字来查询交集,求交集数据,语法“SELECT 字段名 FROM 数据表1 INNER JOIN 数据表2 USING(字段名);”。

droptablet1;

droptablet2;

createtablet1(id intprimarykey,nicknamevarchar(20),playNumvarchar(20));

createtablet2(id intprimarykey,nicknamevarchar(20),playNumvarchar(20));

insertintot1values(1,1,10);

insertintot1values(2,2,20);

insertintot1values(3,3,30);

insertintot2values(1,1,10);

insertintot2values(2,2,200);

insertintot2values(3,33,300);

commit;

推荐内容