types - MYSQL Database Structure - Storing Multiple Values -
i have questions regarding new database structure.
1. let's user can create recipe. each recipe have several ingredients. each ingredient have following 4 fields.
1. ingredients 2. quantity of ingredients 3. unit size of ingredients 4. prep method ingredients
i have been racking brain trying figure out how structure this. should create 4 rows , contain each 1 of inputs array , store in row belongs to? best way , efficient?
2. if have description field , directions field length of characters unknown, blob type best here?
thanks!
as ingredients can appear @ many recipes , different recipes can contain same ingredientes have n:n relation between recipes , ingredients.
on other hand, have called relation attributes try like:
- recipes table: recipes
- igredients table: ingredients
- recipe - has - ingredient relation: stored in table: has_ingredient where: quantity, unit size, pre method fields , recipes primary key , ingredients primary key foreing keys.
consider following er diagram:
Comments
Post a Comment