Aaron Zhi
Aaron Zhi

Reputation: 47

PostgreSQL, what does the ending after FROM stand for?

For example

select * from table1 rel

what does rel mean?

also

select * from ( select id from table1) main where (data)principal.

what does main and principal mean? they are not keyword and anything.

Upvotes: 1

Views: 80

Answers (2)

Isitar
Isitar

Reputation: 1449

it's an alias, have a look at the documentation: https://www.w3schools.com/sql/sql_alias.asp

or here from postgresql: https://www.postgresql.org/docs/current/static/queries-table-expressions.html#QUERIES-TABLE-ALIASES

Upvotes: 0

nicolasl
nicolasl

Reputation: 441

PostgreSQL is assuming that "rel" is the alias for "table1", once the reserved word "AS" is not required. Same for the second case.

Cheers

Nikao

Upvotes: 1

Related Questions