Chapter 5: SQL Statements
5.3 CREATE SYNONYM
Description
Creates a synonym for the table, view or synonym specified. A synonym is an alias that SQL statements can use instead of the name specified when the table, view, or synonym was created.
Syntax
CREATE [PUBLIC] SYNONYM synonym
FOR [owner_name.] { table_name | view_name | synonym } ;
Arguments
PUBLICSpecifies that the synonym will be public: all users can refer to the name without qualifying it. By default, the synonym is private: other users must qualify the synonym by preceding it with the user name of the user who created it.
Users must have the DBA privilege to create public synonyms.
SYNONYM synonymName for the synonym.
FOR [owner_name.] { table_name | view_name | synonym }Table, view, or synonym for which SQL creates the new synonym.
Example
CREATE SYNONYM customer FOR smith.customer ; CREATE PUBLIC SYNONYM public_suppliers FOR smith.suppliers ;
Authorization
Users executing CREATE SYNONYM must have the DBA privilege or RESOURCE privilege. Users executing CREATE PUBLIC SYNONYM statement must have the DBA privilege.
- SQL Compliance
Extension
- Environment
Embedded SQL, interactive SQL, ODBC applications
DROP SYNONYM