CREATE SYNONYM command

This command creates a PUBLIC synonym name for a database object.

Syntax

CREATE SYNONYM synonym_name
  FOR object_name
Keyword Description
SYNONYM Creates a synonym name for a table name
synonym_name Name of the synonym to create
object_name Name of the table or view to which the synonym name applies

Use

You can create synonyms for an object in the database. Synonyms can currently be created for base tables or views. The synonym name can then be used in place of the object name in queries. Note that users of the synonym name must have appropriate privileges to the base object to which the synonym applies. Synonyms are useful in that a user can access data from tables existing in other user schemas (authorization IDs) without having to specify that user's schema.

The DROP synonym command is used to remove a synonym name.

Example

CREATE SYNONYM REPS FOR Mary.ALL_REPS_LOCATIONS