MySQL Forums
Forum List  »  Newbie

Represent mulit-select choice where one choice is exclusive
Posted by: Will Lucic
Date: February 23, 2025 01:46AM

What would be a good way to represent answers to questions that allow you to select multiple choices, but where one choice is exclusive. Ex:

Select all that apply:
A) First
B) Second
C) Third
D) None apply

Any combination of A, B, and C are valid, but D cannot be chosen alongside other choices.
Answering is also optional.

If I have a "choices" table with choice ids and text, and a "responses" table with responder ids and choice ids (multiple rows for a responders that choose multiple), could I put a constraint on the "responses" table so that choice "D)" is exclusive?

If so, I'm not sure how to create a constraint that checks existing table contents.
I'm also not convinced that a constraint would be a good solution.

Options: ReplyQuote


Subject
Written By
Posted
Represent mulit-select choice where one choice is exclusive
February 23, 2025 01:46AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.