sql 表内容复制 insert into select语法

insert into 新表(字段1,字段2,…….) select 字段1,字段2,…… from
旧表

mysql教程_connect(localhost,root,123456);mysql_select_db(db_test);mysql_query(set
names ‘utf8’);$query = mysql_query(insert into test2(id,title,date)
select id,title,date from test1);if($query){ echo ok;exit;}

mssql 用法

–2.创建测试数据 insert into table1 values(‘赵’,’asds’,’90’) insert
into table1 values(‘钱’,’asds’,’100′) insert into table1
values(‘孙’,’asds’,’80’) insert into table1 values(‘李’,’asds’,null)
go

–3.select into from语句创建表table2并复制数据 select a,c into table2
from table1 go

–4.显示更新后的结果 select * from table2 go –5.删除测试表

网站地图xml地图