Home > Database > Mysql Tutorial > body text

What is the concept of CTAS (CREATE TABLE AS SELECTED) in MySQL?

WBOY
Release: 2023-09-09 19:41:14
forward
1133 people have browsed it

MySQL中CTAS(CREATE TABLE AS SELECTED)的概念是什么?

CTAS, the "Create Table AS Select" script is used to create a table from an existing table. It copies the table structure as well as the data in the existing table. Consider the following example where we have created a table named EMP_BACKUP from an existing table named "Employee" structure and data in the Employee" table to create a table named "EMP_BACKUP".

mysql> Select * from Employee;

+------+--------+
| Id   | Name   |
+------+--------+
| 100  | Ram    |
| 200  | Gaurav |
| 300  | Mohan  |
+------+--------+

3 rows in set (0.00 sec)
Copy after login

We can observe that it copies all the data and structure of the "Employee" table.

The above is the detailed content of What is the concept of CTAS (CREATE TABLE AS SELECTED) in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template