CREATE TABLE ...就像不工作

CREATE TABLE ... LIKE not working

需要帮助尝试使用 CREATE TABLE ... LIKE 创建 table,代码如下,给出的错误是

Incorrect syntax near the keyword 'LIKE'

CREATE TABLE jobserve_reports LIKE Jobserve

我曾尝试将 LIKE 放在引号中,但没有成功,尝试将其设为临时 table,使用大括号,但没有任何效果。我已经无计可施了。

如果 LIKE 在您的数据库中不可用,您可以使用 create select

CREATE TABLE jobserve_reports AS 
select * from  Jobserve

或同等学历

最终使用

CREATE TABLE jobserve_reports AS 
select * from  Jobserve
where 1 = 2 

没有结果

SQL Server中,我们可以使用:

创建
SELECT * 
INTO newtable 
FROM oldtable 
WHERE 1 = 0;

对于 Postgres, MS sql-server and Oracle 使用 AS 关键字:

CREATE TABLE new_table
    AS SELECT * FROM old_table;

MySQL 中,您也可以使用 AS 关键字,但它是可选的:

CREATE TABLE new_table
    AS SELECT * FROM old_table;

CREATE TABLE new_table
    SELECT * FROM old_table;