arekmust
New Contributor III

Hi there!

aliases must be strings. If your column alias contains space, special character, or is a number, then grab it within a backticks. See example below:

 

select 
  order_id,                     -- No Alias - Works
  order_id as ORDER_ID,         -- String - Works
  -- order_id as "ORDER_ID",    -- Double quotes - Syntax Error
  -- order_id as 'orderid',     -- Single quotes - Syntax Error
  -- order_id as _@+$,          -- Specia chars - Syntax Error
  order_id as `_@+$`            -- Backticks - Works
from my_view

 

Output :

arek_must_0-1737968328773.png

Table alias should have been used without quotes as well 🙂

Cheers!