What is the difference between SYNONYM and ALIAS?

Answer Posted / venu

A table or view can be referred to in an SQL statement by
its name, by an alias that has been defined for its name, or
by a synonym that has been defined for its name. Thus,
aliases and synonyms can be thought of as alternate names
for tables and views.
An alias can be defined at a local server and can refer to a
table or view that is at the current server or a remote
server. The alias name can be used wherever the table name
or view name can be used to refer to the table or view in an
SQL statement
The differences between aliases and synonyms are as follows:

* SYSADM or SYSCTRL authority or the CREATE ALIAS
privilege is required to define an alias. No authorization
is required to define a synonym.
* An alias can be defined on the name of a table or
view, including tables and views that are not at the current
server. A synonym can only be defined on the name of a table
or view at the current server.
* An alias can be defined on an undefined name. A
synonym can only be defined on the name of an existing table
or view.
* Dropping a table or view has no effect on its aliases.
But dropping a table or view does drop its synonyms.
* An alias is a qualified name that can be used by any
authorization ID. A synonym is an unqualified name that can
only be used by the authorization ID that created it.
* An alias defined at one DB2 subsystem can be used at
another DB2 subsystem. A synonym can only be used at the DB2
subsystem where it is defined.
* When an alias is used, an error occurs if the name
that it designates is undefined or is the name of an alias
at the current server. (The alias can represent another
alias at a different server, which can represent yet another
alias at yet another server as long as eventually a
referenced alias represents a table or view.) When a synonym
is used, this error cannot occur.

Is This Answer Correct ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of dclgen in db2?

588


can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well

1806


Can one database have multiple instances?

583


What is commit in db2?

596


What is isolation level in db2?

577






What is copy pending status in db2?

637


What is bind in db2?

608


What is the cobol picture clause of the db2 data types date, time, timestamp?

619


How does a cursor work?

558


What is check constraint in db2?

608


What is the difference between drop table and delete table?

555


What is the role of union all and union

650


What is bufferpool in db2?

580


How does cobol compile db2 program?

609


What is cursor with hold option in db2?

612