What is difference between Rename and Alias?

Rename is a permanent name given to a table or column whereas Alias is a temporary name given to a table or column which do not exist once the SQL statement is executed.

Showing Answers 1 - 39 of 39 Answers

pavan

  • Feb 27th, 2006
 

rename is used to change name of the table/column.

once we rename the table/column, old column/table name  is replaced by new column/table name.

alias is the alternate name of the table/column.

Mainak Aich

  • Mar 1st, 2006
 

If we rename a column or a table it is parmanent but alias is not permanent.Each time we have to specify the alias.

nitin

  • Aug 25th, 2006
 

the difference is that

rename is used to change the name of the column or table!
alias it is a name given to table which is used as an object extracting the information from the table and gives more meaning to query implemented!
it is just like an object.variable which we use in OOP's concept!

the_xxx

  • Mar 27th, 2007
 

I would like add one more point.

Rename will change the name of the coulmn/table permanently , where as alias is Query Specific ( name of the coulmn is changed for the query reference).

hari

  • Aug 6th, 2007
 

Rename of a column or table is a permanent change where alias is a object for a column or table where it can be referred instead of using a long column or table names. For eg. usage of alias is
1. Joins
2. Subqueries

velsowmya

  • Aug 7th, 2007
 

Rename is used for changing the name of the column or table.
where as alias is the command used tio change the column name for query purpose.
Basically alias are used mostly in joins

purnachand_venu

  • Oct 31st, 2007
 

alias is temporary name from column/table . we can't participate in any operation using that alias name. where as rename is a new name given for exiting table or column name.. using this name we can participate in any operations. when ever we given rename for table/column the old name is no more in database

emraan

  • Dec 29th, 2009
 

rename emp_1 to emp123


select * from emp123 

alter table emp123 rename column job to post

Thanks & Regards

  Was this answer useful?  Yes

Both RENAME and ALIAS are functionally same but only their approach is different.   A RENAME function is used to change a table or column name.

To rename a column
ALTER TABLE table_name RENAME COLUMN old_col TO new_col;

To rename a table
ALTER TABLE old_table_name TO new_table_name;

An ALIAS is also similar to RENAME which is used to display the name of table/col with the name you desire, but the approach is diffrent from RENAME

An alias name is preceded with a keyword "AS" for better understanding
SELECT empno AS emp_id FROM emp;

NOTE: If there are any white spaces in the new name then they must be enclosed with qoutation marks

SELECT empno AS "emp number" FROM emp;

  Was this answer useful?  Yes

Pandurang

  • Dec 15th, 2017
 

Rename is used to change the name of the table permanently.
Alias is the alternate name of the table

  Was this answer useful?  Yes

Asish

  • Jan 7th, 2018
 

Rename: Renaming to a object.

Allows: Referring to a object to avoid the ambiguity on entity or attribute.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions