I’m new to web development and could really use some advice. Thank you all in advance!
I have a form where I ask users to rate their experience in several areas (Mental, Physical, Fun) from 1 – 10. There are about 10 areas in all. Is it worth it to make a table of areas and a intersection table with areaID and userID? In this case, wouldn’t it be easier to just create one table with 11 columns (one for each area plus a userID)?
I understand that a table of ‘areas’ with a key of areaID would be the most robust, and allow me to later add more areas but I really don’t see myself doing that. Also, as I only expect <1000 users, would adding another column to a MySQL db be a lot of work?
Finally, what is the cutoff point where I actually should use a many-to-many structure? Later in the form I have users rate ~30 fields from 1 – 4. Should I use the two table system there?
Thanks again!
It’d be better to use the separate child table. The SQL overhead for a join is minimal, and you get total flexibility in how many/few entries you want to allow, without ever having to change the database structure.
It may only be 10 areas now, but PHBs are notorious for changing their minds about something that was “bedrock” on the hour before launch.