Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design: Best way to represent checkbox optional items?

I have a table in MySQL that holds information about a users licence which has 15 optional qualifications that they may possess on their licence. These are represented as 15 checkboxes on the web form.

Is there a good way to store this information other than just having 15 BOOLs in the table with them being set True or False accordingly?

Thanks

like image 820
Daniel Granger Avatar asked Mar 26 '26 18:03

Daniel Granger


1 Answers

A good way to approach this would be to have three tables:

  1. Your table that holds details of user licence e.g. userLicence
  2. A table holding a list of all checkbox options e.g. licenceOption
  3. A mapping table detailing which options are applicable to which userLicence e.g. userLicenceOptionMapping
like image 174
Tom Mac Avatar answered Mar 28 '26 20:03

Tom Mac