When designing software with databases is it worth normalising enumerations into separate tables?
e.g. if I have a class:
public class Alert { public int ID public System.DayOfWeek AlertDay; public string Message; }
Should my corresponding Alert table simply be something like:
CREATE TABLE Alert ( ID INT IDENTITY, AlertDay INT, Message VARCHAR(50) )
Or should I normalise the days of the week to a separate table and add a FK relationship to my Alert table?
Is there a rule of thumb for this kind of design decision?
Not usually. The days of the week aren’t likely to change, and you don’t want to have to perform an unnecessary join.
On the other hand, you do want to make sure that the source of your ‘days of the week’ is consistent and not going to change (e.g. localization, capitalization, abbreviation, etc).