aliases in sql

The aliases in SQL can be used to give a  temporary name to a table, or a column in a table.

Why we use Aliases in SQL?
Aliases are used to make temporary names.
Aliases are used to make column names more readable.
Aliases exist only when we run the query. It does not change the table structure.

Syntax of Alias Column 
SELECT columnName AS aliasName
FROM table_name;

Syntax of Alias Table
SELECT columnNames
FROM tableName AS aliasName;

Example of aliases in SQL

SELECT name AS n, fee AS f
FROM students;

aliases in sql

Let’s see one another example in which we have created two aliases.
one for the name column and one for the fee column.
if the alias name contains spaces, then we need to use the double quotation marks or square brackets in our query.

SELECT name AS “n b”, fee AS f
FROM students;

Exercise: Download the Database of aliases in sql and practice it on your XAMPP phpMyAdmin.

How to SQL PERFORMANCE TUNING?