Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:47:16+00:00 2026-06-10T15:47:16+00:00

I realize in many cases, putting None might not seem so bad. However, I

  • 0

I realize in many cases, putting “None” might not seem so bad. However, I want to use the values in this particular lookup table (several thousand rows) in a different table which contains several non-nullable fields that relate directly to the data which comes from the lookup table.

Real-World Scenario:

The lookup table is a list of generic drug names, and contains codes for joining on other databases separate from our application.

We have a prescription table which stores DrugId, OrderId (FK), frequency, dosage, etc., all which are presently non-nullable.

In certain scenarios, prescription information for an order is required, so solving the problem simply by not having a record (and no other means of tracking,) will not suffice–we need to be able to know why there are no prescriptions entered and be able to re-populate the correct reason when reviewing the data at a later date.

One idea is to add “None” as part of the Drug lookup table, which forms the basis for this question. I worry about taking this approach for several reasons:

  • it seems like in every scenario when we want to consume the data, we much remember to account for this (with a couple minor exceptions, since as inner-joining on a 3rd party database.)
  • This seems very non-obvious for anybody coming onto the project, (not to mention a pain in the butt,) and must be tested for uniquely. Maybe doing this with “None” alone isn’t so bad, but what about it we wanted to add “Declined” or “Don’t Know” into the mix? Now there are 3 non-obvious exceptions sitting in our look-up table which must be accounted for EVERY SINGLE TIME the data is accessed.
  • Either we make the currently required fields nullable or insert bogus data into them.

Other ideas to address this scenario are:

  • add a new column to the order with options such as “has prescriptions,” “declined,” “no prescriptions.” This isn’t desired since tens of thousands of rows will be ‘null,’ but otherwise doesn’t seem too bad.

  • make a new table to log only the ‘exceptional’ cases, such as “none” or “don’t know” for when the field is required. This is, at the moment, the one which appeals to me the most, since it creates very obvious exceptional cases which must be accounted for. The downside, of course, is a new table (one-zero relationship,) with a very small number of columns. This seems like it would be the simplest form of data to consume for re-population of the UI.

Thoughts of the SO community?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:47:17+00:00Added an answer on June 10, 2026 at 3:47 pm

    You could add two fields to order

    LookupValueID NULL FK,
    PrescriptionType tinyint
    

    With PrescriptionType = (Present = 1, Null = 2, Declined = 3, DontKnow = 4, ...)

    And add a CHECK constraint:

    (PrescriptionType = 1 AND LookupValueID IS NOT NULL)
    OR (PrescriptionType <> 1 AND LookupValueID IS NULL)
    

    That way, you inline a constant number of common special cases into the main table (Orders I think) and enforce data correctness using a constraint.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize this has been asked hundreds of times, however, I can't seem to
I realize this is syntactically bad but I figure it somewhat explains what I'm
So, I realize this is out of the normal use case of Hibernate, but...
I realize there seems to be many questions on this forum for searching multiple
I realize that there are many similar questions, but most involve scaling down the
I realize that keywords and descriptions are old-school SEO techniques and many search engines
I try to realize a link (in fact many links) that update a table
I realize that virtual template functions are not allowed in c++. Because of my
I realize that a SO user has formerly asked this question but it was
We have an app with highly interrelated data, i.e. there are many cases where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.