SQL for Smarties | SQL Programming Style | Trees and Hierarchies in SQL | SQL Puzzles and Answers | Data and Databases

Tuesday, May 23, 2006

Does an AGE dimension make sense

SQL Apprentice Question
I am new in designing a data warehouse. Does it makes sense to have
a dimension table called AGE where maybe numbers from 10 - 100 are in
it? Maybe I should callculate the age in my query ?! I think it is OK
to have a TIME dimension wich is responisble for the birthday, and
other dates in the fact table. Otherwise I have to update the AGE
relationship daily.

Celko Answers
Do you need the age at the time of the event you are modeling or do you
the birthdate to calculate the current age? How accurate do you need
to be? Days, months or years?

If you have the time of the event, then either birthdate or age can be
calculated from the other. For example, "On 2005-10-31 Billy Jones
was 10 years old and bought candy.." versus "On 2005-10-31 Billy
Jones who was born in 1995 bought candy.."

No comments: