«Back to Home

Oracle Jump Start

Topics

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.
  1. Column_name AS Alias_name;  
Example
  1. Select * from employee;  
1
  1. Select Emp_id, Emp_name as "Name"    
  2. from Employee    
  3. Where DEPT_NO = 101;     
2
 
Table Aliases
 
If you are using table aliases, you can use Dot method to the columns.
 
Syntax
  1. Table_name Alias_name;  
Example
  1. select Employee.DEPT_NO, Employee.Emp_name  
  2. from Employee;  
3 
 
Example
  1. select * from Employee, Department  
  2. where Employee.Dept_no = Department.DEPT_ID;  
4 
 
Example
  1. Select Employee.Dept_no, Employee.Emp_Name, Department.Dept_id  
  2. From Employee  
  3. Inner Join Department  
  4. on Employee.Dept_no = Department.Dept_id;  
5 
 
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.