How to create an ALIAS TAB2 for DB2 table TAB1?


The ALIAS is basically a different name given to a particular object in a database. An ALIAS can be defined for a table, view or another alias and the existence of the object is not verified during the creation of the alias. The ALIAS is used to hide the location qualifier and we need SYSADM authority to create a new ALIAS. When the object is dropped, its corresponding ALIAS is not dropped.

We can use the below command in order to create a new ALIAS for a table.

CREATE ALIAS T1
   FOR DBSET1.TAB1

The CREATE ALIAS reserved words are followed by the name of ALIAS which needs to be created. Then we have to mention the name of the table qualified by database using FOR parameter. This will create a new alias T1 for the table TAB1 which is residing in database DBSET1.

Updated on: 12-Sep-2020

197 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements