Answers for "how to create empty table from an existing table in sql"

SQL
4

sql empty table

-- Quick, no possible rollback
TRUNCATE TABLE my_table;
-- With possible rollback
DELETE FROM my_table;
COMMIT;  -- or ROLLBACK;
Posted by: Guest on February-27-2021
0

Write a query to create an empty table from an existing table?

CREATE TABLE new_table
  AS (SELECT *
      FROM old_table WHERE 1=2);
Posted by: Guest on May-12-2021

Code answers related to "how to create empty table from an existing table in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language