Database statement-based table creation, data table copying, and statement copying
1. Database tabulation statements
Create table tb_People (id integer primary key, Name varchar (255), Sex varchar (255 ))
2. Copy data tables from the same database
SQL: insert into table1 select * from table2 (full copy) insert into table1 select distinct * from table2 (no duplicate copy ); insert into table1 select top 10 * from table2 (first 10 copies)
3. Copying data tables in different databases
DB1 and DB2 are two databases, tb_boy and tb_girl are the tables of the first two databases respectively.
SQL:
Insert into DB1.tb _ boy select * from DB2.tb _ girlinsert into DB1.tb _ boy select * from DB2.tb _ girl (full copy) insert into DB1.tb _ boy select distinct * from DB2.tb _ girl (no duplicate copy); insert into DB1.tb _ boy select top 10 * from DB2.tb _ girl (first 10 copies)
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.