Insert table and CREATE table as differences

Source: Internet
Author: User

Insert into table1 (columns1,columns2) Select columns1,columns2 from table2;

The results of the query from Table2 are inserted into the Table1, provided that Table1 and table2 already exist;

Select Columns1 into table2 from table1 is not supported in Oracle ;

Its syntax is create. As .. Select, there are the following three ways;

1. CREATE TABLE table1 as select * from Table2 where 1=2;

Create a table structure that is identical to table2, and copy only the structure without copying the data;

2.create table table1 as select * from table2 ;

Create a table with the same table structure as the table2, and copy the structure while copying the data;

3.create table table1 (columns1,columns2) as select columns1,columns2 from table2; Create a table with the same table structure as the table2, copy the structure and copy the data, but specify the column name of the new table

Note "http://www.cnblogs.com/Neil223/p/5213895.html"

Insert table and CREATE table as differences

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.