Database design - Optional fields
I'm about to add a开发者_C百科 field which gives users an optional title. Is it good practise to create an extra table with 1 or more fields with an id to serve as a lookup? Is this considered efficient and are there other solutions?
If you are going to offer people a choice from a list of titles, and intend to do analysis on this field, then it would be worthwhile to normalize it. Otherwise, the minor savings in space would be unlikely to outweigh the inconvenience.
Empty fields don't take up any space in a database unless they are fixed width (and maybe not even then, depending on the DMBS). The benefit is not in avoiding empty fields, it would be in avoiding repeated or dirty data, which makes decent analysis impossible.
For Searching purpose it is best to have extra table, but for only optional title you can create another field in same table.
精彩评论