SQL allows renaming tables in from and join clauses by providing the optional keyword as followed by the new table name. The table is only known by its new name in the clauses that follow in order of logical evaluation.
SELECT …
FROM tbl_a [AS] a
JOIN tbl_b [AS] b
The SQL standard requires every table in from and join to have a name. Therefore, tables that don’t have a natural name—such as sub-queries—must use this syntax to assign a name.
E051-08, “Correlation names in the FROM clause”, is a mandatory feature of ISO/IEC 9075-2:2023. It already appeared in ANSI X3.135-1989 but without the optional keyword as, which was introduced with ISO/IEC 9075:1992 as part of the level “intermediate”. Accepting the keyword as became mandatory with ISO/IEC 9075-2:1999.
You can’t catch up on 20 years of SQL evolution in one day. Subscribe the newsletter via E-Mail, Bluesky or RSS to gradually catch up and to keep modern-sql.com on your radar.
About the Author
Markus Winand provides insights into SQL and shows how different systems support it at modern-sql.com. Previously he made use-the-index-luke.com, which is still actively maintained. Markus can be hired as trainer, speaker and consultant via winand.at.