What is the difference between for instance:
SELECT coalesce(a,b,c) AS d from table;
and
SELECT coalesce(a,b,c) d from table;
both returns the same result. Does it means that AS is optional?
Yes, it is optional. From the documentation: "The AS keyword is optional, but only if the new column name does not match any PostgreSQL keyword"
SELECTstatement, Chapter 7 "Queries" looks like a good starting point. Then I open that, and I see a chapter "Select List Items" - and there you go. Reading a manual is not the same as using a search engine. Finding your way around manuals is just as important as learning the actual technology