The most compact means of copying a table is to:
- Initially, create a new table using the "CREATE TABLE" statement
- And you have to use "INSERT" based on the "SELECT" from the old table:
INSERT INTO new_table
SELECT * FROM old_table
In the SQL Server, You need to use the "INTO" syntax:
SELECT *
INTO new_table
FROM old_table
Because in the SQL Server, the "INTO" clause creates a table that doesn't already present.
Join the SQL Training course now if you want to gain more knowledge in SQL.