hey there,
i need some advice.
have a situation where a Users table has a Category field, and users need to be placed in 1 to 50 different categories.
i wanted to foreign key the User's Category field to a Category table, but since each user will have multiple categories, i don't think i can use the mySQL foreign key features (which i find somewhat confusing anyway. innoDB??)
so i thought i would set it up like this:
Category field in Users table is CHAR and would contain comma separated ids (something like 12,15,75,...)
those numbers would correspond to an auto_increment unique key in the Category table other than the pri_key.
so, my questions are these:
am i correct is not using the Category table's pri_key? i had assumed that since there is no "internal connection" between the fields, when categories are deleted the pri_key field will renumber itself and all of my associations will be inaccurate.
what else might i need to keep in mind in order to ensure data integrity? and/or is there a better way to do this?
any advice would be appreciated,
mason