Alias (SQL)
Appearance
You can give an another name to a table by using an alias.
This can be a good thing to do if you have very long or complex table names.
Note: An alias name could be anything, but usually it is short.
Syntax: SELECT * FROM table_name AS alias_name
For Example:
DepartmentID | DepartmentName |
---|---|
31 | Sales |
33 | Engineering |
34 | Clerical |
35 | Marketing |
SELECT D.DepartmentName
FROM Department AS D
Note: We can also write like this
SELECT D.DepartmentName
FROM Department D