State about ALIAS concept
Alias means another name\alternate name.
It is divided into two types.
1)Table Alias
2)Column Alias
State about COLUMN ALIAS concept
- ALIAS provides alternate name
- It is useful while doing calcuations
- Though this concept we can create column heading in OUTPUT of query
- This column alias can be created through AS key word
- Column ALIAS can be used only in ORDER BY CLAUSE.In other clauses of SELECT statement we can't use
Syntax for COLUMN ALIAS:
Q: Write a Query to compute total value of SALES table by creating alias column as TOTAL?
We have to compute Total column as Quantity * price (* represents multiplication)
Syntax: Select Item,Quantity,Price, Quantity * Price as TotalCost from dbo.Sales
Syntax for TABLE ALIAS:
Q: Write a Query to create alias column of SALES table?
Syntax:Select * from sales as s