Page 1 of 1

Is it possible to add or copy one more column to the newly created table by using sub query?

Posted: Sat May 15, 2021 1:31 pm
by Nandhakumar
Hi All,
One doubt.

I have created table by using below query👇,

CREATE TABLE test_table AS ( SELECT employee_id,salary FROM employees WHERE employee_id IN (100,101,102,103,104,105))

well it is working👍

Now my question is?
Is it possible to add or copy one more column to the newly created table by using same method.

I tried by below query👇 but its not working.

ALTER TABLE test_table ADD AS (SELECT department_id FROM employees WHERE employee_id IN (100,101,102,103,104,105));

Could some one help me ?