SQL pseudonyms are utilized to incidentally rename a table or a section heading.
SQL pseudonyms are utilized to give a database table, or a segment in a table, a impermanent name.
Basically pseudonyms are made to make segment names more readable.
SQL Alias Syntax for Columns
SQL Alias Syntax for Tables
FROM table_name AS alias_name;
In this instructional exercise we will utilize the example database.
Below is a determination from the "Clients" table:
|2||Barbara W. Messerly||405-289-4169||RobertCBray@jourrapide.com||Brishemed||ou6eeseeRei|
|3||Billy P. Losada||804-567-0813||BillyPLosada@armyspy.com||Dited1976||evahNgaiz1|
|4||Edna M. Hymel||618-966-9060||EdnaMHymel@armyspy.com||Procke||Oojo7is4ei|
And a determination from the "Occupation" table:
Alias Example for Table Columns
The following SQL proclamation indicates two pseudonyms, one for the CustomerName segment and one for the ContactName column.
In the accompanying SQL proclamation we join four sections (Email Adderss, User, Pass) and make a nom de plume named "Address":
Alias Example for Tables
The following SQL proclamation chooses every one of the requests from the client with CustomerID=4 (Around the Horn). We utilize the "Clients" and "Requests" tables, and give them the table assumed names of "c" and "o" individually (Here we have utilized assumed names to make the SQL shorter):
FROM Customers AS c, Orders AS o
WHERE c.CustomerName="Around the Horn" AND c.CustomerID=o.CustomerID;
Aliases can be helpful when:
- There are more than one table engaged with a query
- Functions are utilized in the query
- Column names are enormous or not very readable
- Two or more sections are joined together