codescracker


sql

SQL Aliases



« Previous Tutorial Next Tutorial »


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;

SQL Alias Example

Here is an example of alias in SQL. Consider, we have the following SQL table:

sql aliases

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:

sql aliases example

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test