Tuesday, November 06, 2007

My explanation on Database Synonym

This morning, one of my ex-colleague - Teck Ho asked me a database question through MSN. He wanna knows what is a "Database Synonym". It's a bit hard to explain such technical question via text, thus I came out an example and this is what I told him.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = =

Synonym is like a nickname for a table owned by other user. Meaning you don't want to use the original name of the table while you access it, instead you want to use another name - this nickname of the table is called synonym.

As an example. You are "TeckHo", then you has a table called "Ugly". You want other people to call your "Ugly" table as "Lengjai", thus you can create a synonym for your "Ugly" table like this "create synonym Lengjai for TeckHo.Ugly;". So people will call your ugly table lengjai instead whenever they wanna use it - "select * from lengjai;".

= = = = = = = = = = = = = = = = = = = = = = = = = = = = =


Oh, I think this can really helps him in remember what is synonym for. I'm so pui fuk myself in explaining this too.

3 comments:

David said...

Sai ng sai like that ah :P

Tammy said...

haha.. isn't it easier for people to understand?

Tammy said...

thanks! ^^