- Column alias renames a column heading in a query.
- Its an alternate name for an exiting oracle object.
- The column alias is specified in the SELECT list by declaring the alias after the column name by using the space separator.
- Alias heading appears in UPPER casing by default.
- The alias should be declared in double quotes (“ “).
- Alias is declared after the column with minimum of one space.
- The AS keyword can be used between the column name and alias.
- An alias effectively renames the SELECT list item for duration of the query only.
- An alias cannot be used, any where in the SELECT list for operational purpose.
Note : Never consider Alias as a column
Example
:=
1)
Select 20 + 10 Mysum from dual;
2)
Select ename, sal salary, comm
commission from emp;
3)
Select sal “Basic Salary” from emp;
4)
Select ename, empno, sal AS Salary from
emp;
5)
Select empno AS Numbers,
Ename
AS Name,
Job
AS Designation,
Sal
AS Salary,
Hiredate
AS JoinDate
From
emp;
- - Either use Numbers
or Use as “Number” as a alias, never use Number as a alias.
No comments:
Post a Comment