You want to make a temporary (buffer) table which had a same structure and data with original, use this SQL:

CREATE TABLE xyz_new AS
SELECT *
FROM xyz;

xyz_new is a temporary (buffer) table; xyz is original table.


If you want to clone table’s structure without original data, use this SQL:

CREATE TABLE xyz_new AS
SELECT *
FROM xyz
WHERE 1 = 0;

 

*Note: trigger/constraint/sequence not cloned  (only structure w/ or w/o data)

 

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Written by Fikri Akbarsyah Anza, M.Kom

Lecturer