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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:18:16+00:00 2026-05-15T09:18:16+00:00

Assume I have the following tables ( **bold** – primary key, *italics* – foreign

  • 0

Assume I have the following tables (**bold** – primary key, *italics* – foreign key):

patient(**patient_id**, name)
disease(**disease_id**, name)
patient_disease(**p_d_id**, *patient_id*, *disease,_id* )

I want to draw the ER diagram for this. My idea is to make two entities, one for patient and one for disease, then make a n-to-n relation between them, with p_d_id as its attribute. Is that how it’s supposed to be?

  • 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-15T09:18:18+00:00Added an answer on May 15, 2026 at 9:18 am

    Your entities and n2n relationship are ok, but the p_d_id key is not needed, if that 3 are the only fields of patient_disease, then (patient_id, disease_id) is enough as its primary key.
    Having p_d_id as primary key would let you have many rows with the same patient_id and disease_id, and what would that mean? for stating that a patient had a disease, it’s enough with one just one row.
    If, in change, you had another field, for example date, to signify the date in which a patient had a disease, then it would make sense to have an id of its own, because a patient could have the same disease twice, at different dates, but again, in that case, the date could be part of the primary id.

    note: In relational theory, ‘relation’ and ‘relationship’ are different concepts, in your question, you wrote ‘relation’ but that’s really a ‘relationship’. A ‘relation’ is just a tuple, an instance of an entity, what in the DB would be a row.

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

Sidebar

Related Questions

Assume I have the following tables and relationships: Person - Id (PK) - Name
I have the following tables: employee(ename,street,city) where ename is primary key company(cname, city) where
Ok, so assume I have the following tables: recipes id (pk) name added modified
I have a question about cascading deletes and foreign key references: Let's assume the
To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck
Assume the following in MySQL: CREATE TABLE users ( id integer auto_increment primary key,
What I have is the following db structure(tables): lists[name,id] list_items[title,list_id,content] I've created the needed
Assume I have the following tables: TABLE: foo - foo_id (PK) TABLE: tag -
Assume the following tables: TABLE: foo ========================= | foo_id | fk_id | name |
I have the following tables: PERSON_T DISEASE_T DRUG_T ========= ========== ======== PERSON_ID DISEASE_ID DRUG_ID

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.