DEV Community

Discussion on: Algebraic data types in SQL

Collapse
 
brandinchiu profile image
Brandin Chiu

Which portions of the day are you looking to store?

Are you storing the answers themselves, or the structures of the questions?

If you don't need or plan on doing any kind of complex queries using the data structure, and you just need a data store, you can make use of something like MySQLs JSON data type and just store the entire thing like a document.

Otherwise a relational system should have no problem breaking up your questions.

Simply store the question type and possible values in separate tables.

Collapse
 
koredefashokun profile image
Oluwakorede Fashokun

In the case of multiple-choice questions, I plan to store the questions, choices and answers. In every other case, just questions and answers. Since I'm using Hasura, it really has to be type-safe, to make sure there are no surprises or edge cases when parsing.