Home > Back-end >  How to make column name of query result in UPPERCASE
How to make column name of query result in UPPERCASE

Time:08-27

How to make column name of query result in UPPERCASE (Postgres)

SELECT USER_NAME, USER_AGE from table; 

Result

user_name user_age
First 123
Second 234

Expectation : Result column name to be in uppercase (USER_NAME USER_AGE instead of user_name and user_age).

CodePudding user response:

You can create an alias:

SELECT user_name as "USER_NAME", 
       user_age as "USER_AGE" 
from table; 

For details on how identifiers are treated see the manual

  • Related