Create Oracle Table AS Statement
Published by : Obay Salah , November 26, 2024
The CREATE TABLE AS statement is used to create a table from an existing table by copying the columns of existing table.
Note: If you create the table in this way, the new table will contain records from the existing table.
Syntax:
CREATE TABLE new_table AS (SELECT * FROM old_table);
Create Table Example: copying all columns of another table
In this example, we are creating a "newcustomers" table by copying all the columns from the already existing table "Customers".
CREATE TABLE newcustomers AS (SELECT * FROM customers WHERE customer_id < 5000); Table created.
This table is named as "newcustomers" and having the same columns of "customers" table.
Comments
no comment yet!