SQL statements for Oracle replicated tables

Source: Internet
Author: User

as follows, table A is a table that already exists in the database, and B is a table that is ready to be copied from table A:

1. sql that replicates only the table structure

CREATE TABLE B as select * from a where 1<>1

2. sql that replicates the table structure and replicates the data in the table

CREATE TABLE B as select * from a

3. Copy the SQL of the table's development fields

CREATE TABLE B as select Row_id,name,age from a where 1<>1//if row_id,name,age are columns of a table

4. SQL to copy the specified fields of the table and the data for those specified fields

CREATE TABLE B as select Row_id,name,age from a

Although the above statement can easily be based on the structure of a table to create a B table, but the index of a table can not be copied, you need to manually set up in B.

5. Insert into will save the query results to the existing table

Insert into T2 (column1, Column2, ...) select Column1, Column2, .... from t1

SQL statements for Oracle replicated tables

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.