Database statement Building table, copy data table

Source: Internet
Author: User
Tags db2
1. Database Build Table statement
create table tb_People(id integer primary key, Name varchar(255), Sex varchar(255))
2. Copy data table with database
sql:insert into table1 select*from table2(完全拷贝)insert into table1 select distinct*from table2(不重复拷贝);insert into table1 select top 10*from table2(前10条拷贝)
3. Do not copy data tables in the same database

DB1, DB2 for two databases, Tb_boy, Tb_girl table for the first two databases
Sql:

insert into DB1.tb_boy select*from DB2.tb_girlinsert into  DB1.tb_boy select*from DB2.tb_girl(完全拷贝)insert into  DB1.tb_boy select distinct*from DB2.tb_girl(不重复拷贝);insert into  DB1.tb_boy select top 10*from DB2.tb_girl(前10条拷贝)

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Database statement Building table, copy data table

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.