ALIAS:-
- Alias means another name (or) alternative name.
- It is two types.
(i) Column Alias -> Alias declared for column is called column alias
(ii) Table alias -> Alias declared for table is called Table alias
Column Alias:
Syntax: Colname/
Example : Select ename, sal, sal*12 as Anusal from emp.
Ename Sal Anusal
A 500 6000
B 600 7200
C 700 8400
- If column alias contains space, alias must be given to Double quotes.
Example : – Select ename, sal, sal*12 as “Anual sal” from emp.
- Display ename,sal,hra,da,tax and totsal
Hra 30%sal
Da 20%
Tax 10%
Total sal+hra+da-tax.
Example :- Select ename,sal,sal*0.3as hra,sal*0.2 da,sal*0.1 tax,sal+ (sal*0.3)+ (sal*0.2)-(sal*0.1) total from EMP.
Table alias:
Syntax: tablename [as] alias.
Example: Select * from emp as e