SELECT INTO (insert into) and INSERT INTO SELECT (insert into select) Two phenotypic copy statement

1.INSERT INTO SELECT statement
 

      Statement in the form of: Insert into Table2 (field1, field2, ...) select value1, value2, ... from Table1

 

      Table2 required target table must exist, since the target Table2 table already exists, we insert the source table Table1 except field, but also can be inserted constants.

 

 

 2.SELECT INTO FROM statement

 

      Statement form: SELECT vale1, value2 into Table2 from Table1

 

      Table2 required destination table does not exist, because the table is automatically created upon insertion of Table2, and replication fields specified in Table1 data in Table2.

      Statement in the form of: Insert into Table2 (field1, field2, ...) select value1, value2, ... from Table1

 

      Table2 required target table must exist, since the target Table2 table already exists, we insert the source table Table1 except field, but also can be inserted constants.

 

 

 2.SELECT INTO FROM statement

 

      Statement form: SELECT vale1, value2 into Table2 from Table1

 

      Table2 required destination table does not exist, because the table is automatically created upon insertion of Table2, and replication fields specified in Table1 data in Table2.

Guess you like

Origin www.cnblogs.com/mafeng/p/11344207.html