SQL Aliases
SQL Aliases
SQL Aliases SQL alias are victimized to give a tabularise, or a pillar in a tabularise, a temporary name.Aliases are oft victimized to make pillar list more decipherable. An alias only exist for the duration of that query.An alias is make with the AS keyword.
Alias Column Syntax :
SELECT column_name AS alias_nameFROM table_name;
Alias Table Syntax:
SELECT column_name(s)FROM table_name AS alias_name;
alias for pillar example :
The next SQL statement make two aliases, one for the CustomerID editorial and one for the CustomerName editorial:
SELECT CustomerID AS ID, CustomerName AS Customer
FROM Customers;
The follow SQL command create two a.k.a.es, one for the CustomerName column and one for the ContactName column. note: It necessitate dual quote mark or feather bracket if the a.k.a. name arrest space:
SELECT CustomerName AS Customer, ContactName AS [Contact Person]FROM Customers;
The postdate SQL statement create an a.k.a. cite 'destination' that mix tetrad column (destination, PostalCode, city and country):
SELECT CustomerName, Address + ', ' + PostalCode + ' ' + City + ', ' + Country AS Address
FROM destination;
0 Comments