SYNONYMS

Prerequisites

You have generated the demo data for the SQL Tutorial.

Log on to the demo database instance DEMODB as user MONA.

Define synonyms. To do this, use the CREATE SYNONYM Statement (create_synonym_statement).

Examples

You can use the system table SYNONYMS to determine the following database information, among other things:

?     The table (basis table, view table) for which the PUBLIC synonym SHORT_TAB was defined

SELECT tableowner, tablename
  FROM DOMAIN.SYNONYMS
    WHERE public = 'YES'
      AND synonymname = 'SHORT_TAB'

?     Private synonym for the CITY table of the user MONA

SELECT synonymname
  FROM DOMAIN.SYNONYMS
    WHERE tableschemaname = 'HOTEL'
      AND tableowner = 'MONA'
      AND tablename = 'CITY'

Existence of a synonym: see TABLES