I need to create user defined column name like below Postgresql query into HiveSql. Could you please help me on this.
x
SELECT
COUNT(user_id) as "Total Customers"
FROM
customer_profiles
WHERE
profiled_date BETWEEN '2020-01-01' AND '2020-12-31'
Advertisement
Answer
Use backticks:
SELECT
COUNT(user_id) as `Total Customers`
FROM
But it is not possible to preserve case due to Hive limitation. Resulted column name will be in lower case:
total customers
See this answer: https://stackoverflow.com/a/57183048/2700344