Content deleted Content added
Fjerdingen (talk | contribs) Add self join as usage. And clarify correlation name is the SQL standard term. Remove obfuscating sentence, as I can't find any reliable source. |
hyperlink |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
{{Short description|Feature of SQL}}
{{refimprove|date=October 2013}}
An '''alias''' is a feature of [[SQL]] that is supported by most, if not all, [[RDBMS|relational database management systems (RDBMSs)]]. Aliases provide users with the ability to reduce the amount of code required for a query, and to make queries simpler to understand. In addition, aliasing is required when doing self joins (i.e. joining a table with itself.)
In SQL, you can alias tables and [[Column (database)|columns]]. A table alias is called a '''correlation name''', according to the SQL standard.<ref>ANSI Standard SQL – Foundation Document – Date: 2010-10-14</ref>
The general syntax of an alias is <syntaxhighlight lang="sql" inline>SELECT * FROM table_name [AS] alias_name</syntaxhighlight>. Note that the AS keyword is completely optional and is usually kept for readability purposes. Here is some sample data that the queries below will be referencing:
|