91-9990449935 0120-4256464 |
PostgreSQL AliasPostgreSQL Aliases are used to provide temporary names for columns or tables. You can create a temporary name for a column or a table by using PostgreSQL Alias. Generally a temporary table is created when you perform self join. PostgreSQL Alias ColumnSyntax: Parameter explanation: column_name: It specifies the original name of the column that you want to alias. alias_name: It specifies the temporary name that is assigned to the column. table_name: It specifies the name of the table. AS: It is optional. Most programmers will specify the AS keyword when aliasing a column name, but not when aliasing a table name. Note:
See this example: Let's take a table "EMPLOYEES" having the following data. EMPLOYEES Table Execute the following query: Output: PostgreSQL Alias TableSyntax: Parameter explanation: table_name: It specifies the original name of the table that you want to alias. alias_name: It specifies the temporary name that is assigned to the table. AS: It is optional. Most programmers will specify the AS keyword when aliasing a column name, but not when aliasing a table name. Note:
Let's take a table "EMPLOYEES" having the following data. Table1: EMPLOYEES Create another table "DEPARTMENT" having the following data. Table2: DEPARTMENT Now, following is the usage of TABLE ALIAS where we use E and D as aliases for EMPLOYEES and DEPARTMENT tables, respectively: Execute the following query: Output:
Next TopicPostgreSQL Indexes
|