Reputation: 4776
I found the following query from a reference note and I could see naming lineitem
table as l1
and lineitem
table as l2
.
select avg(l_extendedprice) from lineitem l1
where l_extendedprice =
(select min(l_extendedprice) from lineitem l2
where l1.l_orderkey = l2.l_orderkey);
Is this a valid aliasing method, without explicitly using AS
? If this is not aliasing in Postgres, what is this convention?
Upvotes: 12
Views: 10582
Reputation: 247235
The SQL standard lets you use aliases with or without AS
.
The difference is that without AS
, you cannot use a PostgreSQL keyword as alias, see the documentation. So it's safer to always use AS
.
Upvotes: 15