当前位置:Gxlcms > 数据库问题 > 数据库语句之建表、拷贝数据表

数据库语句之建表、拷贝数据表

时间:2021-07-01 10:21:17 帮助过:2人阅读

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条拷贝)

版权声明:本文为博主原创文章,未经博主允许不得转载。

数据库语句之建表、拷贝数据表

标签:数据库

人气教程排行