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

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

Jun 01, 2016 pm 01:37 PM
structure surface

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
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the syntax and structure characteristics of lambda expressions? What are the syntax and structure characteristics of lambda expressions? Apr 25, 2024 pm 01:12 PM

What are the syntax and structure characteristics of lambda expressions?

In-depth analysis of the structure and purpose of the MySQL.proc table In-depth analysis of the structure and purpose of the MySQL.proc table Mar 15, 2024 pm 02:36 PM

In-depth analysis of the structure and purpose of the MySQL.proc table

What is the origin of the basic structure and technology of the internet? What is the origin of the basic structure and technology of the internet? Dec 15, 2020 pm 04:48 PM

What is the origin of the basic structure and technology of the internet?

How to design the mall's evaluation table structure in MySQL? How to design the mall's evaluation table structure in MySQL? Oct 31, 2023 am 08:27 AM

How to design the mall's evaluation table structure in MySQL?

How to implement a layout with a fixed navigation menu using HTML and CSS How to implement a layout with a fixed navigation menu using HTML and CSS Oct 26, 2023 am 11:02 AM

How to implement a layout with a fixed navigation menu using HTML and CSS

Exploring the internal structure of the Linux file system Exploring the internal structure of the Linux file system Mar 21, 2024 am 10:03 AM

Exploring the internal structure of the Linux file system

What are the common flow control structures in Python? What are the common flow control structures in Python? Jan 20, 2024 am 10:38 AM

What are the common flow control structures in Python?

How to implement the statement to view table data in MySQL? How to implement the statement to view table data in MySQL? Nov 08, 2023 pm 01:40 PM

How to implement the statement to view table data in MySQL?

See all articles