in reply to OT: benefits of database normalization
ID will be primary key and auto increment, so you don't have to worry about duplicate IDs. Type will be int, since mySQL uses int space for bools anyway, and you might want other types in the table (flagged for checking, flagged for delete, etc). Name will be whatever the max size of your words is. Desc will be the max size of your descriptions. You can use different field names if name and type give errors, and aliases will have ID-delimiter-name in the desc field.
Yes, this does make for potential problems if you remove a word and forget to also remove all aliases pointing to it, but a simple DELETE FROM table WHERE desc = 'ID-delimiter-name' will fix that. Just do it before you delete the word, NOT after. The only downside is that your aliases take up extra space (description length minus alias info length), but then again, you only have to do one query per word access, not two (if you have aliases or descriptions in a separate table), and you don't have fields that aren't being used (if you keep alias info separate from description field in the same table). Alias deletion itself does not have to be efficient, since you will hardly ever delete words.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OT: benefits of database normalization
by revdiablo (Prior) on Oct 04, 2004 at 05:06 UTC |