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 8707781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:57:15+00:00 2026-06-13T03:57:15+00:00

I need help with this design, a Diagnosis can be based on evidence or

  • 0

I need help with this design, a Diagnosis can be based on evidence or test result or both. I have separate evidence table (eg: cough, medicine can be prescribed with out any other test) and Test table (eg: blood test). I want the diagnosis table to address all scenarios (based on evidence only, based test result only, based on both evidence and test result. My table structure is Diagnosis_id, patient_id, evid_id, test_id,Dignosis_name. I want to refer evid_id and test_id as foreign key but having this would mean I must always provide both values, which wouldn’t be the case. Any advice?

  • 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-13T03:57:16+00:00Added an answer on June 13, 2026 at 3:57 am

    A foreign key can be null.

    You’d probably need a query like

    select patients.name, diagnoses.id, evidence.text, tests.text
    from patients inner join diagnoses on diagnoses.patient_id = patients.id
    left join evidence on diagnoses.evid_id = evidence.id
    left join tests on diagnoses.test_id = tests.id
    where ....
    

    Using left joins means that you’ll always get a result set, regardless of whether the diagnosis is linked to the evidence table or the tests table (or neither).

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

Sidebar

Related Questions

I really need help getting this query right. I can't share actual table and
I am new to android and need help on this. I have two views
I need your help with my database design. I'm trying to develop a Result
Hi I need some help with this. The design calls for a vertical line
I need help on both the visual and the programmatic end of this one.
Okay, I need some help here. This is the same old "can't use an
I'm hoping someone can help me decide the best way to model this design
Just need help as I have been trying sort this out for ages now.
I need help designing a SQL table. Suppose I have cardnumber , cardtype ,
I need help/advice for improving/commenting my current design please :) This relates to collision

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.