§ SQL aliases are used to
temporarily rename a table or a column heading.
§ Basically aliases are created
to make column names more readable.
Syntax for Columns
SELECTcolumn_nameASalias_name
FROMtable_name
Syntax for Tables
SELECTcolumn_name(s)
FROMtable_nameASalias_name;
Here is a SQL statement with
alias
§ Example
SELECTo.OrderID,o.OrderDate,c.CustomerName
FROM Customers AS c, Orders AS o
WHEREc.CustomerName=’Around
the Horn’ANDc.CustomerID=o.CustomerID;
The same SQL statement without
aliases:
§ Example
SELECTOrders.OrderID,Orders.OrderDate,Customers.CustomerName
FROM Customers, Orders
Comments
Post a Comment