Alias (SQL): Difference between revisions

Content deleted Content added
Mention the table_alias(column_alias, ...) syntax.
WikiCleanerBot (talk | contribs)
m v2.04b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
Line 46:
</syntaxhighlight>
 
Some systems, such as Postgres<ref>[https://www.postgresql.org/docs/13/queries-table-expressions.html#QUERIES-FROM PostgreSQL: Documentation: 13: 7.2. Table Expressions]</ref> and Presto,<ref>https://prestodb.io/docs/0.248/sql/select.html SELECT — Presto 0.248 Documentation</ref>, support specifying column aliases together with table aliases. E.g.
 
<syntaxhighlight lang="sql">
Line 52:
</syntaxhighlight>
 
would produce the same result set as before. In this syntax it is permissible to omit aliases for some column names. In the example, an alias was provided for DepartmentId, but omitted for DepartmentName. Columns with unspecified aliases will be left unaliased. This syntax is often used with expressions that do not produce useful table and column names, such as VALUES<ref>https://prestodb.io/docs/0.248/sql/values.html#examples VALUES — Presto 0.248 Documentation</ref> and UNNEST.<ref>https://prestodb.io/docs/0.248/sql/select.html#unnest SELECT — Presto 0.248 Documentation</ref>. As an example, one may conveniently test the above SQL statements without creating an actual Departments table by using expressions such as
 
<syntaxhighlight lang="sql">