Monday, December 1, 2014

Defining a Column Alias

A column alias:
      Renames a column heading
      Is useful with calculations
      Immediately follows the column name (There can also be the optional AS keyword between the column name and alias.)
      Requires double quotation marks if it contains spaces or special characters or if it is case-sensitive
Using Column Aliases

SELECT first_name AS name, com_pct comm
FROM   emp;

NAME
COMM
John

Kery

…..
SELECT first_name "Name" , salary*12 "Annual Salary"
FROM   emp;

NAME
ANNUAL SALARY
John

Kery


…..

 

 

No comments:

Post a Comment