Select*fromEmployee;+------+--------+|Id |Name |+------+--------+|100 |Ram ||200 |Gaur"/> Select*fromEmployee;+------+--------+|Id |Name |+------+--------+|100 |Ram ||200 |Gaur">

Home  >  Article  >  Database  >  What is the concept of CTAS (CREATE TABLE AS SELECTED) in MySQL?

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

WBOY
WBOYforward
2023-09-09 19:41:141119browse

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)

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete