Synonyms in SQL

Synonyms:

        Ø A synonym is a database object that is used as an alias name for any object.

        Ø  A synonym is an alternative name for a table, view, sequence, procedure, stored function and package.

Uses of synonyms:

Ø Synonyms are used to shorten or clarify the names of object with long or hard to decipher names.

 ØHide the real identify of an object.

Ø Simplify SQL statements

Display the synonym Lists:

  1.           Select * from User_synonyms;

Syntax:

  1.           Create synonym < synonym_name>

    For<server_name>.<database_name>.<schema_name>.<object_name>;

Example:

  1. Create synonym Product_items

    For Productserver. ProductDatabase.Apps.Products;

 OR

  1. Create synonym <synonym_name>

     For <object_name>;

Example:

  1. Create synonym Product_items

    For Products;

Drop synonym:

Syntax: 

  1. Drop synonym < synonym_name >;

Example:

  1.  Drop synonym product_items;


 

 

 

Share:

No comments:

Post a Comment

Popular Posts

Search This Blog

Powered by Blogger.

Blog Archive

Service Support

Need our help to Learn or Post New Concepts Contact me

Blog Archive

Recent Posts

Service Support

Need our help to Learn or Post New Concepts Contact me