create table newTb as select * from oldTb where 1=0; insert into c select a.id from a inner join b on a.id = b.id;