To copy a new table from the original table in DB2

Source: Internet
Author: User

In SQL, there are two types of data replication to the original table, in two ways, insert into and select INTO.

Detailed instructions:

INSERT into From:insert into new table name (column 1, column 2 ...) Select column 1, column 2......from source table name where constraint condition; (This command uses the prerequisite: the target table already exists)

SELECT INTO From:select column 1, column 2, ... into the new table name (column 1, column 2 ...). From the source table name (This command uses the prerequisite: the target table does not exist).


In DB2, insert into from can be used normally, but select into from cannot be performed because DB2 restricts select to from and inserts one row of data at a maximum at a time.

Therefore, to copy a table in DB2, you can use the

CREATE table ' new table name ' like ' source table name ';

insert into from;

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.