您的位置:首页 > 数据库 > MySQL

MySQL表结构复制、表数据迁移以及临时表、视图创建

2013-05-01 23:19 459 查看
1、只拷贝表结构,不拷贝数据
select * into b from a where 1<>1;

2、表数据迁移 表b已经存在:
insert into b (d, e, f) select a, b, c from a;
表b原先不存在:
create table b (select a, b, c from a);

3、创建临时表
创建临时表的语法很简单,临时表存在内存中,会话结束即消失:
create temporary table a (...);

4、创建视图
视图属于数据库:
create view test.myView as select a, b from a;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: