== Edit # 3 == Updated ERD with the ability to store free answers to forms, and also linked patient_reponse_option to the question_option_link website so that the patients answer is saved with the correct options context (we know which question the answer is too). I will send some inquiries soon.
== Edit # 2 ==
Updated ERD with form data
== Edit # 1 ==
A short answer to your question: no, 400 columns is the wrong approach. Alternatively, check the following diagram:
== Original ==
According to your recent board, you will want to include a pivot table. The summary table breaks the M: M relationship between “patients” and “options,” for example, many patients may have many options. For this you do not need a table with 400 columns, you just need to include the aforementioned pivot table.
Example circuit:
// patient table tableName: patient id: int(11), autoincrement, unsigned, not null, primary key name_first: varchar(100), not null name_last: varshar(100), not null // Options table tableName: option id: int(11), autoincrement, unsigned, not null, primary key name: varchar(100), not null, unique key // pivot table tableName: patient_option_link id: int(11), autoincrement, unsigned, not null, primary key patient_id: Foreign key to patient (`id`) table option_id: Foreign key to option (`id`) table
With this scheme, you can have any number of “options” without adding a new column to the patient table. Which, if you have a large number of rows, will crush your database if you ever need to run the alter table add column
command.
I added the identifier to the pivot table, so if you ever need to process individual rows, it will be easier to work with them, and also to know that the patient has _and_and_and_and_and_and_and_and_and_and_and_complex.