2

I am trying to run a basic select Query in PostgreSQL, but I am having trouble using the column alias. I tried to create the alias as randomfield As [Space In Name] but it gave an error of

Error: syntax error at or near "["
Line 2: randomfield As [Space In Name]

And I also tried to do the alias w/o the brackets but that presented an error as well. How do you alias with a space in Postgresql?

Select randomfield As [Space In Name]
From saledata
| improve this question | | | | |
3

Identifiers with special characters require double quotes in SQL:

SELECT randomfield AS "Space in Name" FROM saledata
| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.