Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle Select With AS Statement

The Oracle SELECT AS can be used to create a temporary name for columns or tables.

Oracle SELECT With AS Statement Syntax

To create a temporary name for columns or tables, use the following syntax:

Syntax

SELECT col1 AS alias_name
FROM tablename

OR

SELECT alias_name.col1
FROM tablename alias_name

Parameters:

tablename: The original name of the table that you wish to alias.

column_name: The column name that you wish to alias.

alias_name: The temporary name to assign.

Oracle SELECT With AS Statement examples ALIAS a Column

The following Oracle Select with AS is used to make the column headings in your result set easier to read:

Example

SELECT firstNAme AS NAME
FROM tblCustomerLoan;

OR

SELECT firstNAme AS "NAME"
FROM tblCustomerLoan;

Note:

In the above example, we have created alias for the "firstNAme" column.

Oracle SELECT With AS Statement examples ALIAS a Table

The following Oracle Select with AS is used to create a temporary name for table. It helps you to shorten the table name to make the SQL statement shorter and easier to read:

Example

SELECT T1.firstName,T1.lasttName
FROM tblCustomerLoan AS T1;

OR

SELECT p.firstName, p.lastName, c.cellNo
FROM tblCustomerLoan p
INNER JOIN tblCustomer c
ON p.custId = c.custId;

Note:

In the above example, we have created an alias for the "tblCustomerLoan" table called p and c for "tblCustomer" table.