CREATE TABLE ... AS SELECT ... query allows to create a new table based on the structure and data from other tables (based on the SELECT statement).
In general case, all the data returned by SELECT statement will be copied into a new table.
This statement doesn't create any indexes automatically. If you want to create them, thought, - you should specify it before the SELECT statement:
CREATE TABLE new_table (UNIQUE (col_1)) SELECT col_1, col_2 FROM old_table;
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать