CREATING TABLE FROM OTHER Table

CREATING TABLE FROM OTHER Table

The below one creates new table and copies all data
CREATE TABLE {new_table_name} AS (SELECT * FROM {old_table_name});


The below one creates new table without copying data
CREATE TABLE {new_table_name} AS (SELECT * FROM {old_table_name} WHERE 1=2);


The below one creates table with selected columns only
CREATE TABLE {new_table_name} AS (SELECT column_1, column2, ... column_n FROM {old_table_name});


columns from multiple tables
CREATE TABLE {new_table_name} AS (SELECT column_1, column2, ... column_n FROM old_table_1, old_table_2, ... old_table_n);

0 Comments

Leave a reply

* Your email/mobile address will not be published. required fields are marked.

* Email and mobile number will be verified before publishing the comments.

Name *
Email *
Mobile