資料庫語句之建表、拷貝資料表,語句拷貝

來源:互聯網
上載者:User

資料庫語句之建表、拷貝資料表,語句拷貝
1、資料庫建表語句

create table tb_People(id integer primary key, Name varchar(255), Sex varchar(255))
2、同資料庫拷貝資料表
sql:insert into table1 select*from table2(完全拷貝)insert into table1 select distinct*from table2(不重複拷貝);insert into table1 select top 10*from table2(前10條拷貝)
3、不在同一資料庫中資料表拷貝

DB1、DB2為兩個資料庫,tb_boy、tb_girl分別為前兩個資料庫的表
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條拷貝)

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

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.