How To Use Aliases In Oracle
Description
In Oracle, Aliases create a temporary name for column or table.
A column Aliases refers to-
• Rename a column heading.
• Aliases is useful with calculation.
• Immediately follows the column name.
Syntax
Aliases a column.
- Column_name AS Alias_name;
Example
- Select * from employee;
- Select Emp_id, Emp_name as "Name"
- from Employee
- Where DEPT_NO = 101;
Table Aliases
If you are using table aliases, you can use Dot method to the columns.
Syntax
- Table_name Alias_name;
Example
- select Employee.DEPT_NO, Employee.Emp_name
- from Employee;
Example
- select * from Employee, Department
- where Employee.Dept_no = Department.DEPT_ID;
Example
- Select Employee.Dept_no, Employee.Emp_Name, Department.Dept_id
- From Employee
- Inner Join Department
- on Employee.Dept_no = Department.Dept_id;
Summary
Thus, we learnt, Aliases create a temporary name for the column or table and we learnt, how to use aliases in Oracle with an example.