简体   繁体   中英

Should I have a single table to source the drop-down values or create multiple tables for each drop down

I have multiple drop down box (around 23) on a single web page, these drop downs get their values from SQL database. Should I have a single table to source the drop-down values or create multiple tables for each drop down.

Should I create a table with field id for each drop down and all permitted values for the field or create 22 tables with 2 to 5 values in each table.

eg Gender: has 2 values male/female would it make sense to have table for gender?

In my project, we have single table used to store such options on GUI. There, we have stored such information related to all screens. Columns of table is something like below :

Optiontype - possible values like gender
Optiontype_Code - possible values like M, F
Code _Description -  possible values Male, Female 

You can add more columns to table as per your requirement for fast retrieval of data like screen id or something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM