Column Aliases in Oracle

Home

Topics
Basic Select statements
Select Columns
Arithmetic Expressions
NULL Manipulation
Column Aliases
Concatenation
Duplicates

Column Aliases in Oracle:

Some times you want to change the column headers in the report. For this you can use column aliases in oracle. oracle has provided excellent object oriented techniques as it's robust database. It always good for you to practise and implement column aliases since it will make your code readable while using this columns.

So please follow this to add column aliases to your sql queries.

1).Give a column alias name separated by space after the column name. you can use none or one or more column aliases as per your requirement. e.g is the query to use this kind of column aliases.

  • Select last_name surname, first_name, commission_pct commission, salary employeesalary from employees
In the above query, thewords in bold are column aliases.

2) If we observe the above query results we see all the aliases in all capital letters, some how if you do not want them and you want your own case Use double quotes ". Also if you want to keep space between words and you need it as alias use doble quote e.g.("Employee Salary"). Please follow the below query for this kind of situation. Please note that you can also use "AS" in the query for aliases

  • Select last_name "Surname", first_name AS name, commission_pct as commission, salary "Employee Salary", Employee_id As ID from employees
 
www.iforerunner.com