SQL aliases are used to rename the table or the column heading temporarily. Here is the general form of the alias for the columns:
SELECT column_name AS alias_name FROM table_name;
Now, here is the general form of the alias for the tables:
SELECT column_name(s) FROM table_name AS alias_name;
Here is an example of alias in SQL. Consider, we have the following SQL table:
The following SQL statement specifies the two aliases, one for the column Name and other for the column Address.
It requires double quotation marks or square brackets if the column name contains spaces.
SELECT Name AS FullName, Address AS [City] FROM Customers;
After querying the above SQL statements, you will get the following output:
© Copyright 2021. All Rights Reserved.