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

  • Home
  • SEARCH
  • 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 714309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:03:38+00:00 2026-05-14T05:03:38+00:00

I have three database tables: users emails invitations Emails are linked to users by

  • 0

I have three database tables:

  • users
  • emails
  • invitations

Emails are linked to users by a user_id field.

Invitations are also linked to users by a user_id field

Emails can be created without an invitation, but every invitation must have an email.

I would like to link the emails and invitations tables so it is possible to find the email for a particular invitation.

However this creates a circular reference, both an invitation and an email record hold the id for the same user.

Is this bad design and if so, how could I improve it?

My feeling is that with use of foreign keys and good business logic, it is fine.

users
-----
id

emails
------
id
users_id

invitations
-----------
id
users_id
emails_id
  • 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-14T05:03:39+00:00Added an answer on May 14, 2026 at 5:03 am

    This is not a circular reference.

    It would be if emails would have a strong integrity relationship to invitations and invitations an independent strong integrity relationship back to emails (for example).

    EDIT: regarding the design

    As Henk Holterman points out the question is if your design is normalized to desired extent.

    Assiming tables: primary keys such as

    users: id
    emails: id, users_id
    invitations: id, users_id, emails_id

    and assuming foreign keys on table_id fields and that no other constraints are placed on the tables (such for example only a part of a key being unique) then you have modelled the following:

    • for each user there can be several e-mails and you can not have emails with no corresponding user record
    • for each email there can be several invitations and you can not have invitations with no corresponding e-mail nor user record (note: from the above definition we can not know if the user_id refers to entry in emails or in users)

    Now only you can say if those rules correspond to the ones from the real world situation that you are trying to model.

    One way to look at the database design is – there is actually no wrong database design, you can almost always find data that would make something that looks like an error justified. That’s why without taking both rules (in form of sentences) and the tables (E-R diagram, description of tables and relationships) it is impossible to say if there is a problem in design (though it is possible to give suggestions from personal experience).

    To illustrate – the above note that it is not clear which table user_id refers to might seem easy to answer. And the common answer, considering that you said that every invitation has a mail, is that it should refer to user_id from the mail table.

    Otherwise there could exist an invitation for which user_id recorded on the invitation and the user_id recorded for a mail are different.

    Normally, this should make a red light labelled ‘normalize your data’ go flashing in your mind. But, often unspoken assumption here is that the email_id determines the user_id, and that might not be true(!).

    This depends on the semantics of your data (the predicate of each table) – for example if you are trying to model a situation where it is possible to send invitation to one person, and receive an e-mail reply from another person (for example inviting people through secretary and receiving direct replies), then the red light switches off and all is fine – that is what really happened and that is what you are going to allow for in your design.

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

Sidebar

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.