How do I create a table using data which is already present in another table (copy of table)?
Click the tab for the table with the columns you want to copy and select those columns. From the Edit menu, click Copy. Click the tab for the table into which you want to copy the columns. Select the column you want to follow the inserted columns and, from the Edit menu, click Paste.
A copy of an existing table can be created using a combination of the CREATE TABLE statement and the SELECT statement. The new table has the same column definitions. All columns or specific columns can be selected.
A copy of an existing table can also be created using CREATE TABLE . The new table gets the same column definitions. All columns or specific columns can be selected. If you create a new table using an existing table, the new table will be filled with the existing values from the old table.
The most portable means of copying a table is to:
Use INSERT based on a SELECT from the old table:
INSERT INTO new_table
SELECT * FROM old_table
In SQL Server, I'd use the INTO syntax:
SELECT *
INTO new_table
FROM old_table
...because in SQL Server, the INTO clause creates a table that doesn't already exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With