Wednesday, December 18, 2019

Synonyms in SQL

Synonyms are the database object which is used to provide an alternative name to other database objects. 
Synonym can be used to specify with objects like: 
  • Tables
  • Views
  • Stored Procedure 
  • User-Defined Function
Some points to be remember about synonyms:
  1. A synonym cannot refer to another synonym.
  2. Synonyms cannot be altered using ALTER statement. To modify the synonym you must DROP it and recreate.
Create Synonym
To create a synonym, simply specify a synonym name and name of database object to which it will be assigned.
Syntax:
Create SYNONYM  [schemaname.]synonymname FOR objectname;
Example:
create synonym suppliers for app.suppliers;

Drop Synonym
Syntax:
DROP SYNONYM synonymname;
Example:
Drop synonym suppliers;

0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top