0

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?

1
  • Do you need to put quotes around that? Commented Nov 25, 2020 at 10:54

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.