建表
表1

CREATE TABLE Student(SId VARCHAR(10),Sname VARCHAR(10),Sage DATETIME,Ssex VARCHAR(10));

插入测试数据

INSERT INTO Student VALUES('01' , '赵雷' , '1990-01-01' , '男');

INSERT INTO Student VALUES('02' , '钱电' , '1990-12-21' , '男');

INSERT INTO Student VALUES('03' , '孙风' , '1990-05-20' , '男');

INSERT INTO Student VALUES('04' , '李云' , '1990-08-06' , '男');

INSERT INTO Student VALUES('05' , '周梅' , '1991-12-01' , '女');

表二

CREATE TABLE Student_01(SId VARCHAR(10),Sname VARCHAR(10),Sage DATETIME,Ssex VARCHAR(10));

插入测试数据

INSERT INTO Student VALUES('01' , '赵雷' , '1990-01-01' , '男');

INSERT INTO Student VALUES('02' , '钱电' , '1990-12-21' , '男');

INSERT INTO Student VALUES('03' , '孙风' , '1990-05-20' , '男');

查询不同数据sql
SELECT * FROM A WHERE NOT EXISTS (SELECT 1 FROM B WHERE A.id= B.id)

SELECT * FROM Student WHERE NOT EXISTS (SELECT 1 FROM Student_01 WHERE Student.`Sname`= Student_01.`Sname`)

mysql比较两个表的差异 mysql两张表差异数据_测试数据