Home > Database > Mysql Tutorial > MySQL表结构复制、表数据迁移以及临时表、视图创建_MySQL

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

WBOY
Release: 2016-06-01 13:37:36
Original
1345 people have browsed it

bitsCN.com

1、只拷贝表结构,不拷贝数据

select * into b from a where 11;
Copy after login

 

2、表数据迁移 表b已经存在:

insert into b (d, e, f) select a, b, c from a;
Copy after login

     表b原先不存在:

create table b (select a, b, c from a);
Copy after login

 

3、创建临时表

      创建临时表的语法很简单,临时表存在内存中,会话结束即消失:

create temporary table a (...);
Copy after login

 

4、创建视图

      视图属于数据库:

create view test.myView as select a, b from a;
Copy after login
bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template