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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:04:58+00:00 2026-05-20T01:04:58+00:00

Please excuse the title, I had trouble wording my question without being overly descriptive.

  • 0

Please excuse the title, I had trouble wording my question without being overly descriptive.

My application has tables likes these:
contacts
properties
events

I am adding a method of attaching notes to the items in the above tables. I would like it so that a single note can associate with a contact, property or event (or a combination of the three).

Currently my notes table looks like this:

noteID int
noteCreated datatime
noteContent text
userID int (userid that created the note)
contactID int
propertyID int
eventID int

The portion in question is in bold. Right now, when I create a note for an event, I simply insert the note and also set the eventID. If the event also relates to a contact, I can add the contactID as well (contactID and eventID would be set). While it works, I think it is inefficient and not properly normalized.

What I am trying to do is create a one-to-many relationship, problem is that the “many” part can have different target tables. At the same time I want to reduce the number of queries necessary to select or insert a note.

My thought was to create a table that connects them together, then give properties, contacts, and events their own unique targetType that stays constant. But I still feel that is not the best way to do it. Alternatively I can create a separate relationship table for each target table (notes_properties, notes_contacts, etc…).

noteID int
targetID int
targetType int

Much help would be appreciated. Thank you 🙂

  • 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-20T01:04:59+00:00Added an answer on May 20, 2026 at 1:04 am

    If the relationship between notes and contacts, properties & events is 1 to 1, e.g., a contact can have only one note, then the best way to model it would be to simply add a noteID column to the contact, properties and events table.

    If it’s a many-to-many relationship, e.g., a contact can have many notes, then you would want to create a separate table, say contact_notes with two columns – contactID and noteID.

    Don’t get hung up on the fact that a note can be associated to multiple entities. It really doesn’t affect the way you model it at all.

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

Sidebar

Related Questions

Please excuse the vague title. If anyone has a suggestion, please let me know!
Please excuse the confusing title ;) We've built an ASP.NET MVC application to replace
Please excuse the vague question title, but usually I don't do such kind of
I am a patterns newbie so please excuse this question if it sounds too
Please excuse the newbie question but I was wondering if I used Linq in
Please excuse me but I didn't know to give a name to the title
Please excuse this numpty question, but when I do ChannelFuture future = channel.write(message); future.addListener(new
Please excuse my choice of wording and/or mixup of terms, I am a dummy
Please excuse my ignorance on the subject. I would like to write an application
Please excuse me for a probably low quality of this question, since I'm not

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.