![](/img/trans.png)
[英]Insert records from TABLE_A to TABLE_B without inserting any duplicates
[英]SQL: extract some records from table_A, then insert to table_B
我需要从table_A中提取一些记录,然后将这些记录插入到table_B中。 我有以下伪代码:
insert into table_B (select * from table_A)
我想知道上述伪代码的正确语法是什么? 谢谢!
假设两个表都有匹配的列集,则可以执行以下操作:
insert into table_b select * from table_a;
如果table_b只有table_a列的子集,请手动选择它们,如下所示:
insert into table_b (col1, col2, col3, . . ., colN)
select col1, col2, col3, . . ., colN from table_a;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.