You can create an alias for a table like this:

SELECT * FROM tablename newtablename WHERE conditions

For example

SELECT * FROM employee e1 WHERE e1.name = ‘Gandalf’

My college text-book ‘Fundamentals of Database Systems’ by Elmasri et al. says:

“It is generally advisable to create tuple variables (aliases) for all the tables referenced in an SQL query to avoid potential errors and ambiguities”

However I have found it necessary to use aliases only in rare situations; like when writing co-related sub-queries which involve the same table multiple times.

If you want to rename a table instead of referring to it by another name you will have to use ALTER TABLE.

Leave a Reply