3
Reply

What command is used to create a table by copying the structure of another table?

Pradeep

Pradeep

15y
6.1k
0
Reply

    SELECT * INTO New Table FROM Exiting table SELECT * INTO mytable from HumanResources.Employee

    We can use :


    SELECT Column_list INTO New_Table_Name FROM Original_Table_Name

    Ex:

    select * into customers1 from cusotmers

    Thank you

    CREATE TABLE As SELECT Command.

    Explanation:
    To copy only the structure the where clause of the SELECT command should have a FALSE statement.
    Ex:
    CREATE TABLE newtable as SELECT * FROM exixtingtable
    WHERE 1 = 2

    If WHERE condition is true then all the rows satisfying the condition  will be copied to the newtable.