Setup
I have the following tables:
Questions
- id (INT)
- quizId (INT)
- text (TEXT)
- options (JSON[])
Answers
- id (INT)
- questionId (INT)
- choice (INT)
"options" is an array of JSON objects:
{"{\"text\": \"Text for option 1\", \"correct\": false}", "{\"text\": \"Text for option 2\", \"correct\": true}"}
Question
I would basically like to get the value of "correct", given "choice" (an index), after joining those two tables.
The pseudocode for what I'm trying to achieve would be:
select "Questions"."options"["Answers"."choice"] from <JOIN THOSE TABLES>;
filter
part. Seemed different enough.