Synonyms: – Synonyms are used to giving a different name to the table show that the user can refer the table very conveniently. After creating a synonym table, we can use it as well as existing table. Synonym table is used for only one table. Syntax for creating synonym table is –
Create synonym <synonym table name> for <table name>;
For example: –
Create synonym ec for company;
Here ec is a synonym table name and company is an original table name. after creating synonym table, we can use it as well as existing table. Some example is synonym table.
Select * from ec;
The above example will display listing of columns from table company through synonym column ec.
Delete ec where city=’Chennai’;
In case of above example, all those rows are deleted from table employee which city column=’’Chennai’
Drop synonym ec;
We can delete synonym table and now we do not use duplicate table name.