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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:10:07+00:00 2026-05-26T10:10:07+00:00

I am trying to create a basic internal messaging system. The only ‘special’ consideration

  • 0

I am trying to create a basic internal messaging system. The only ‘special’ consideration is a user can send a message to multiple recipients and a receiver of a message can Reply To All (if applicable). This is what I currently have:

MESSAGE TABLE
- thread_id
- message_id
- subject
- content
- date_sent
- from (FK to user_id)
- to (FK to user_id(s))

READ TABLE
- message_id (FK)
- recipient (FK to user_id, limit one un-read message per thread)
- read (boolean)

Does this DB design seem sufficient for an internal messaging system, or is it lacking anything / any way to improve it?

  • 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-26T10:10:07+00:00Added an answer on May 26, 2026 at 10:10 am

    It seems like there’s a many-to-many relationship between messages and recipients. I would therefore factor that out into a join table; you may as well put the “read” flag on that join table.

    That would give you something like:

    MESSAGE TABLE
    - thread_id
    - message_id
    - subject
    - content
    - date_sent
    - from (FK to user_id)
    
    
    MESSAGE_RECIPIENT TABLE
    - message_id (FK)
    - recipient (FK to user_id)
    - read (boolean)
    

    Your requirement to show only one unread message for a thread is a display issue, and I’d keep it out of the database. In your front-end code, you’d have logic to show the lesser of the actual number of unread messages and 1 when calculating the number of unread messages to show.

    To find all recipients for a message (so you can do “reply all”), you need to join to the MESSAGE_RECIPIENT table, as follows:

    select u.email_address
    from   users u, 
           message m, 
           message_recipient mr
    where  u.user_id   = mr.recipient
    and    mr.message_id = m.message_id
    and    m.message_id  = $whateverYourCurrentMessageIDis
    

    (apologies for the archaic join syntax)

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

Sidebar

Related Questions

I'm trying to create a basic system that will allow only specific users to
I'm trying to create a basic macro recording/playback system. If I wanted to select
I am trying to create a basic WPF application that can store an encrypted
I'm trying to create a basic webservice with WCF. It's small, and will only
I'm trying to create a basic shopping cart, having an issue with the product
Question I'm trying to create a basic wxWidgets program with a text entry box,
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I am trying to just create a basic layout, but i am having trouble
I'm trying to create an element in an XML where the basic content is
I'm trying to implement the WMD editor used on StackOverflow to create some basic

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.