2

This question already has an answer here:

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

marked as duplicate by Paul White Oct 27 '17 at 5:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Identifiers with special characters require double quotes in SQL:

SELECT randomfield AS "Space in Name" FROM saledata

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