Synonyms (study notes)

Source: Internet
Author: User

synonym = alias of table

Grammar:
CREATE [public] synonym synonym name for database object;

Example One,

 --  user created with administrator or with the Create SYNONYM permission  --  create synonyms for Scott  CONN sys/ Change_ On_install as   SYSDBA;  create  Synonym myemp  scott.emp  --  select  *  from   myemp;  --  select  *  from  emp; 

Query whether synonyms are created successfully

SELECT *  from user_synonyms;

If you want to create a common synonym, you only need to precede it with public , so any user with query permission can use the

Log on with an administrator, and create a public synonym

CREATE  Public  for Scott.emp;

Create a new user and log in or, using another user login, you can perform the following

-- Execution SELECT *  from Myemp;

Syntax for deleting synonyms
DROP synonym synonym Name

DROP Synonym Myemp;

Synonyms (study notes)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.