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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:44:53+00:00 2026-05-28T14:44:53+00:00

In database design, can 2 entities have 2 relationships among themselves? i.e for example

  • 0

In database design, can 2 entities have 2 relationships among themselves? i.e for example there are 2 entities donor and admin.. there are 2 relationships
1. admin accesses donor details
2. admin can contact donor and vice versa
can we join them with 2 relationships?

  • 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-28T14:44:54+00:00Added an answer on May 28, 2026 at 2:44 pm

    Definitely, although how much sense it makes to model “accesses” and “contacts” relations in a database depends on your application. I’ll stay with your example though and assume these relations are n to n. Here is how the SQL could look like (warning, syntax not tested):

    CREATE TABLE admin (
        id int unsigned AUTO_INCREMENT PRIMARY KEY,
        name text NOT NULL
    );
    
    CREATE TABLE donor (
        id int unsigned AUTO_INCREMENT PRIMARY KEY,
        name text NOT NULL
    );
    
    CREATE TABLE admin_donor_access_details (
        id_admin int unsigned NOT NULL,
        id_donor int unsigned NOT NULL,
        PRIMARY KEY (id_admin, id_donor),
        CONSTRAINT FOREIGN KEY(id_admin) REFERENCES admin(id) ON DELETE CASCADE ON UPDATE CASCADE,
        CONSTRAINT FOREIGN KEY(id_donor) REFERENCES donor(id) ON DELETE CASCADE ON UPDATE CASCADE
    );
    
    CREATE TABLE admin_donor_contact (
        id_admin int unsigned NOT NULL,
        id_donor int unsigned NOT NULL,
        PRIMARY KEY (id_admin, id_donor),
        CONSTRAINT FOREIGN KEY(id_admin) REFERENCES admin(id) ON DELETE CASCADE ON UPDATE CASCADE,
        CONSTRAINT FOREIGN KEY(id_donor) REFERENCES donor(id) ON DELETE CASCADE ON UPDATE CASCADE
    );
    

    The two relations could also be expressed in a single join table with boolean flags, like this:

    CREATE TABLE admin_donor (
        id_admin int unsigned NOT NULL,
        id_donor int unsigned NOT NULL,
        detail_access tinyint(1) NOT NULL,
        contact tinyint(1) NOT NULL,
        PRIMARY KEY (id_admin, id_donor),
        CONSTRAINT FOREIGN KEY(id_admin) REFERENCES admin(id) ON DELETE CASCADE ON UPDATE CASCADE,
        CONSTRAINT FOREIGN KEY(id_donor) REFERENCES donor(id) ON DELETE CASCADE ON UPDATE CASCADE
    );
    

    This will put some extra effort on your code because you need to determine whether to insert or update a row when adding a relationship, and whether to delete or update a row when removing a relationship, but in my opinion this is still a usable alternative.

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

Sidebar

Related Questions

For you database design/performance gurus out there. If you have a database that is
How would you design a database to support the following tagging features: items can
Does someone have any tips/advice on database design for a web application? The kind
What do I have to consider in database design for a new application which
I have posted a question about multilanguage database design here, [] What are best
I have a database design that's normalized well enough, but now I need to
can some explain to me how the database design would look like for the
I have a database design issue. My project is about products and retailers. Product
I have two options about database design. Edit: It is used for storing the
I have 3 entities: Song Artist Genre One song can have multiple genres and

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.