更新时间:2022-11-25 09:43:01
使用SELECT ... INTO
:
SELECT *
INTO ABC_1
FROM ABC;
这将创建一个新表 ABC_1
,它具有与 ABC
相同的列结构并包含相同的数据.但是,约束(例如键、默认值)不会被复制.
This will create a new table ABC_1
that has the same column structure as ABC
and contains the same data. Constraints (e.g. keys, default values), however, are -not- copied.
您可以每次使用不同的表名多次运行此查询.
You can run this query multiple times with a different table name each time.
如果不需要复制数据,只是新建一个列结构相同的空表,添加一个带有falsy表达式的WHERE
子句:
If you don't need to copy the data, only to create a new empty table with the same column structure, add a WHERE
clause with a falsy expression:
SELECT *
INTO ABC_1
FROM ABC
WHERE 1 <> 1;