Friday, December 21, 2012

SQL Alias


SQL Alias

SQL Aliases are defined for columns and tables. Basically aliases is created to make the column selected more readable.
For Example: To select the first name of all the students, the query would be like:

Aliases for columns:

SELECT first_name AS Name FROM student_details;

or

SELECT first_name Name FROM student_details;

In the above query, the column first_name is given a alias as 'name'. So when the result is displayed the column name appears as 'Name' instead of 'first_name'.
Output:
Name
-------------
Rahul Sharma
Anjali Bhagwat
Stephen Fleming
Shekar Gowda
Priya Chandra


1 comment:

  1. can we use alias name in anthor function variable or not plz sugeest

    ReplyDelete

Thank you :
- kareem