SQL design for survey with answers of different data types

前端 未结 4 608
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 06:32

I am working on an online survey. Most questions have a scale of 1-5 for an answer. If we need to add a question to the survey, I use a simple web form, which does an INSERT

4条回答
  •  春和景丽
    2021-01-06 06:58

    Use a column that specifies the type of answer, but store the answer as text. Your application or front end can use the answer_type column to determine what to display to the end user (a test box, radio buttons, a date picker) and how to validate it before sending it back to the database.

提交回复
热议问题