create table tt1 ( a int not null, b int not null, c int not null, d int not null, primary key (a,b,c,d) ); create table tt2( c int not null, d int not null, e int not null, f int not null, primary key (c,d,e,f) );create temporary table tmp1 select * from information_schema.statistics where table_schema = 'test' and table_name = 'tt1'; create temporary table tmp2 select * from information_schema.statistics where table_schema = 'test' and table_name = 'tt2';select tmp1.column_name as diff from tmp1 left join tmp2 using(column_name) where tmp2.column_name is null; 结果: query result(2 records) diff a b
create table tt1 (
a int not null,
b int not null,
c int not null,
d int not null,
primary key (a,b,c,d)
);
create table tt2(
c int not null,
d int not null,
e int not null,
f int not null,
primary key (c,d,e,f)
);create temporary table tmp1 select * from information_schema.statistics where table_schema = 'test' and table_name = 'tt1';
create temporary table tmp2 select * from information_schema.statistics where table_schema = 'test' and table_name = 'tt2';select tmp1.column_name as diff from tmp1 left join tmp2 using(column_name) where tmp2.column_name is null;
结果:
query result(2 records)
diff
a
b