☰ See All Chapters |
MySQL Synonym
A synonym is merely another name for a table or a view. Synonyms are usually created so a user can avoid having to qualify another user’s table or view to access the table or view. Synonyms can be created as PUBLIC or PRIVATE. Any user of the database can use a PUBLIC synonym; only the owner of a database and any users that have been granted privileges can use a PRIVATE synonym.
All users can generally create a PRIVATE synonym. Typically, only a DBA or privileged database user can create a PUBLIC synonym.
Creating Synonyms
The general syntax to create a synonym is as follows:
CREATE [PUBLIC|PRIVATE] SYNONYM SYNONYM_NAME FOR TABLE|VIEW |
Dropping Synonyms
Dropping synonyms is like dropping almost any other database object. The general syntax to drop a synonym is as follows:
DROP [PUBLIC|PRIVATE] SYNONYM SYNONYM_NAME |
All Chapters