sql 使用SELECT * INTO或SELECT INTO.sql复制表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 使用SELECT * INTO或SELECT INTO.sql复制表相关的知识,希望对你有一定的参考价值。

-- you can copy rows from one table to another using SELECT INTO. This copies the rows but does not copy things like keys, so you'll have to add that in as a second step if you wish to have them.

-- how to copy all rows and columns from one table into a new table
SELECT * INTO customersNew FROM customersOld;

-- how to copy all columns but only certain rows from one table into a new table
SELECT * INTO customersNew FROM customersOld
WHERE CustomerID = 3;

-- how to copy only certain columns from one table into a new table
SELECT CustomerID, LastName, FirstName INTO customersNew FROM customersOld;

以上是关于sql 使用SELECT * INTO或SELECT INTO.sql复制表的主要内容,如果未能解决你的问题,请参考以下文章