Insert all values of a table into another table in SQL

后端 未结 9 968
礼貌的吻别
礼貌的吻别 2020-11-29 16:56

I am trying to insert all values of one table into another. But the insert statement accepts values, but i would like it to accept a select * from the initial_Table. Is this

相关标签:
9条回答
  • 2020-11-29 17:41

    You can use a select into statement. See more at W3Schools.

    0 讨论(0)
  • 2020-11-29 17:42

    From here:

    SELECT *
    INTO new_table_name [IN externaldatabase] 
    FROM old_tablename
    
    0 讨论(0)
  • 2020-11-29 17:49

    You can insert using a Sub-query as follows:

    INSERT INTO new_table (columns....)
    SELECT columns....
    FROM initial_table where column=value
    
    0 讨论(0)
提交回复
热议问题