|
I think this question only applies to Oracle and SQL Server 2005+ users, since I don't think any of the other RDBMS platforms support them.
Access and SQL 2000- do, but in a very roundabout way. You can insert into views (persisted select queries) so you can give a name to a select query for indirection. That's more or less what a real synonym does - it assigns a different name to an object that already exists in your database.
But why? Why would anyone want to do this? Well, lots of reasons.
Security. You're keeping people away from the real tables, and the synonyms themselves can be secured. You can grant a person readonly access to only your synonyms and they won't know about the 100 other tables they shouldn't be looking at. Compatibility - you just made a new table to replace an old one, now you can add a synonym with the old table's name pointing at the new one, and your applications don't need any code level changes. Naming conventions vs simplicity - have it both ways.
This concept has helped me a lot in the past, and we have some smart cookies in here. I wonder what everyone else is up to?
|