I have created new table by:
CREATE TABLE DIFF_ODATE_PERIOD AS
select test_3.odate - test_3.max_period from test_3;
And it gave me column name: ?column?
And when I am trying to change the name it gives me error:
ALTER TABLE DIFF_ODATE_PERIOD
RENAME COLUMN ?column? TO test;
ERROR: syntax error at or near "?" LINE 71: RENAME COLUMN ?column? TO test;
Can I define the name while creating or after?
You would need to alias that column directly in the create table ... as select
statement:
create table diff_odate_period as
select odate - max_period as test from test_3;