Aliases


With SQL, aliases can be used for column names and table names.


 LastName   FirstName   Address   City 
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger

Table Name Alias
The syntax is on the right:
 SELECT  column
   FROM  table AS table_alias

 SQL> select  LastName, FirstName
   2    from  Persons as Employees;

The table on the right is Employees.
 LastName   FirstName 
Hensen Ola
Svendson Tove
Pettersen Kari

Column Name Alias
The syntax is on the right:
 SELECT  column AS column_alias
   FROM  table

 SQL> select  LastName as Family,
   2      FirstName as Name
   3    from  Persons;
 Family   Name 
Hensen Ola
Svendson Tove
Pettersen Kari



The following is an SQL test area from w3schools.com where the Customers table may be created by the following command:
   SQL> create table  Customers (
     2    CustomerID   varchar(16),
     3    CompanyName  varchar(32),
     4    ContactName  varchar(32),
     5    Address      varchar(64),
     6    City         varchar(32),
     7    PostalCode   varchar(16),
     8    Country      varchar(32) );
Note that the Customers table is for read only.