Introduction

Synonyms is database object which can be created as an alias name/duplicate name for any object like table views ,procedure etc.

If we apply any Dml opertaions on synonyms the same opertaions automatically effetced to corresponding base Table and vice versa.

If we create a synonym, The synonym will be created on entire Table ,It is not possible to create the synonym on partial Table

Synonym will became invaild into two cases

1. When we drop the base Table.

2. When we change the base Table Name.

On Invalid synonym we cannot apply any Dml operations.

We cannot create synonym based on more than one Table at a time

When we change the structure of the base table the corresponding synonym automatically reflectedwith same change.

Syntax-

Create synonym <synonym name> from <TN/Object name>

Example:

Create synonym syn1 from employee

To execute the above query it will create a synonym syn1 on Employee Table for accessing the data using Dml opertaions

Importnat point About Synonyms

1.Generally the Synonyms are using in Remoting enviroment for accessing the data from mutiple locations.

2.Synonyms will provide security for original Table Names in Database

Views

Synonyms

It is a virtual or logical Table of the base Table

It is a Alias Names of the Base Table

It doesn’t contains physical existence and it doesn’t occupy memory

It contains physical Existence and occupy memory

It can create on multiple Tables at a time

It will create on a single Table only

It will provide the security to the original Table Names and also Data.

It will provide security for the original Table Names only but Not data.

By using view we can hide or Restrict the specific rows and columns in the Table