How to create a new table with the same structure of a specified table? Options

codeling 1247 - 5334
@2016-02-04 11:07:42

Suppose you have a table named employee with the following columns:

  • employee_id
  • last_name
  • job_id
  • commission_pct
  • department_id

And you want to create new table named contract_workers with the same columns as employee table, the fastest way to chieve this is to run the following DDL statement:

CREATE TABLE contract_workers AS (SELECT * FROM employees where 1=2);
Users browsing this topic