我正在使用H2数据库。我尝试了以下SQL,但也复制了记录:
"CREATE TABLE test_tmp AS SELECT * FROM test"
我也试过这个sql:
"CREATE TABLE test_tmp AS SELECT * FROM test WITH NO DATA",
但是我遇到了语法错误异常。所以你知道如何复制没有记录的表吗?
答案 0 :(得分:4)
Create table testtmp as select * from test where 1=0
答案 1 :(得分:2)
SELECT * INTO test_tmp FROM test WHERE 1=2