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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:47:05+00:00 2026-05-30T01:47:05+00:00

I am creating an application (desktop) to store and retrieve patients’ records along with

  • 0

I am creating an application (desktop) to store and retrieve patients’ records along with diseases. As patients and diseases have a many to many relationship, so I’ve created three tables; PATIENTS, DISEASES and one is Junction table. As one patient can register more than once in a single disease over the time so ‘PATIENTS’ table contains composite primary key of patient’s ‘reference no’ and ‘registration date’. Table ‘DISEASES’ only contains ‘name’ as a primary key.

Now I am a little confused about the design of junction table. It is containing the composite primary key of ‘PATIENTS’ table and a primary key of ‘DISEASES’ table as foreign keys.

Should I make composite primary key of all these foreign keys in junction table or create another primary key or something different?

Any help would be greatly appreciated.

  • 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-05-30T01:47:06+00:00Added an answer on May 30, 2026 at 1:47 am

    I would suggest you one more table for cases. This table would contain an entry date. You should not use the disease name as primary key. This would make it difficult to correct typos or simply to choose a more appropriate name in the future, or maybe you would want to have a Latin as well as an English name.

    Patient table
    -------------
    PK  PatientID
        Name
        DateOfBirth
        etc.
    
    Disease table
    -------------
    PK  DiseaseID
        Name
    
    Case table
    -------------
    PK  CaseID
    FK  PatientID
        EntryDate
        etc.
    
    CaseDisease table
    -------------
    PK, FK  CaseID
    PK, FK  DiseaseID
    

    Now you have these relations

    Patient --1:n--> Case --1:n--> CaseDisease <--n:1-- Disease
    

    EDIT:

    The case table might not be necessary for now and might seem to be over-designed. However, should it turn out in future, that you have to store other data to a case as well; the db design would not have to be changed fundamentally.


    UPDATE:

    Alternatively, you could do it without a case table. In that case, the junction table would have a date as part of the primary key

    PatientDisease table
    -------------
    PK, FK  PatientID
    PK, FK  DiseaseID
    PK      Date
    

    The relations would be

    Patient --1:n-->  PatientDisease <--n:1-- Disease
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating window c# desktop application I have three columns in my datagridview
I'm creating a Desktop Java application which needs to store (what could become) reasonably
I am creating a Java desktop application. In this application I have one table.
I am creating java desktop application. in the application i want to create many
I am creating a java desktop application.I have two button create and cancel. if
Case : I'm creating an application (desktop application) with VB.NET (actually windows form), and
I'm creating a Java desktop application and was wondering how I should deal with
I'm creating a java desktop application that draws a map in a JFrame designing
I'm creating a training lab for a desktop application. Basically it'll be a series
I'm in the process of creating a traditional desktop application, and I'd like to

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.