數據庫語句之建表、拷貝數據表

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_girl
insert 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條拷貝)
發佈了58 篇原創文章 · 獲贊 22 · 訪問量 16萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章