Avatar of trueguru
trueguru
 asked on

What is the correct database design for a "How did you hear about us?" with a customizable "Other" option?

I have a relational database with a user table in it.

I have a website with a "How did you hear about us?" dropdown list.

The dropdown list is table driven. The table used to populate the dropdown has options like "Station 1", "Station 2", etc. One of the options in the drop down is "Other".

When the user selects "Other" a textbox appears so they can input their custom answer. The user then clicks save and the selected option is stored in the database.

Herein lies the problem. What would the ideal normalized table structure look like for storing the selected option when the selected option is "other" and contains extra data. I can think of several ways to do structure it but none of them seem "clean" to me.

One option would be to add a column to the user table and store the text value there but this isn't normalized.
DatabasesOracle Database

Avatar of undefined
Last Comment
trueguru

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
trueguru

ASKER
Yes I thought about this. Definitely you want the ID from the "WhereDidYouHearAboutUs" table but it doesn't seem correct to store the extra "Other" field data in the user table.

I don't believe that there is a more "elegant" solution so, unless someone else comes up with an alternative, I'm going to accept your solution and continue coding.

Thank you!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck