There is another type of aliasing called aliasing for tables which is generally used while using 2 or more tables more likely in joins.
- This aliasing is used without keyword AS and for the main purpose of calling those different tables within query with ease and more query readability.
- Normally these joins are used up in all types of joins.
Syntax
SELECT * from TableName T;
Here T is the alias for TableName and from now on when we need to call a column from TableName T is called despite it.
For this example, we will be using the employees and office table to merge with the common office id column.
Example
select * from employees e, offices o where e.office_id = o.office_id;
- Here we have aliased the two tables with e and o and conditioned them with WHERE to call the office id of two tables using the alias name we just named.
Related Content
Tags