Hello,
2nd time poster here and just learning MySQL and PHP using the 4th Edition.
I've got my DB setup for a mobile web app that will basically used to enter in attributes of different items, let's call them widgets, gadgets and frazzles. I am trying to determine the best way to store the options available for certain attributes. Some attributes will require a number input, which isn't the problem. Many of the attributes will be a selection of one of 3-7 choices. In order to keep my tables normalized, my thought is to create an attrib_value table and store the options using Data Type ENUM and then use a foreign key to link the attribute to the proper attribute values and have them displayed as a pull-down in a form.
lMy tables are like this
Table1: item_type
id_item_type INT NN UN AI
item_name VARCHAR() NN
item_descrip VARCHAR ()
Table2: item_attrib
id_item_attrib INT NN UN AI
fk_id_item_type INT NN
attrib_name VARCHAR() NN
attrib_units VARCHAR()
Table3_attrib_value
id_attrib_value INT NN UN AI
fk_item_attrib INT NN
attrib_value ENUM('x','y','z') NN
There is a 1:N identifying key between the item_attrib table and the attrib_value table. Does this make sense to do it this way or is there a better way that I am not seeing?
Thanks everyone for your insight!