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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:00:35+00:00 2026-05-27T19:00:35+00:00

I am looking to find the best practice for many to many mapping in

  • 0

I am looking to find the best practice for many to many mapping in database.

For example I have two tables to be mapped. I create third table to store this mapping.

Database Diagram

On UI I have several A to be mapped(or not) multiple with B. And I see two solutions for now:

1 – On every update for every record from A I will delete all mapped data for it and insert new data mapping.

  • Advantage: I store only mapped data.
  • Disadvantage: I need to use delete and insert statement every time.

2 – I need to add new bit column to AB table with name isMapped. And I will store all mapping for every record from A to every record from B. On save mapping action I will use only update statement.

  • Advantage: No need to delete and insert every time.
  • Disadvantage: Need to store unnecessary records.

Can you offer me best solution?

Thanks

  • 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-27T19:00:35+00:00Added an answer on May 27, 2026 at 7:00 pm

    between the 2 options you have listed I would go with option no 1, isMapped is not meaningful, if they are not mapped the records should not exists in the first place.

    you still have one more option though:

    DELETE FROM AB where Not in the new map
    INSERT INTO AB FROM (New map) where NOT in AB
    

    if these are a lot of maps I would delete and insert from the new mapping, otherwise I would just delete all then insert like you are suggesting.

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

Sidebar

Related Questions

Looking for the best practice for authentication in MVC I unfortunately didn't find the
I am looking to find the slope between two vectors via linear regression in
I'm looking for a best practice for managing configuration on a project with multiple
I'm looking for a way to have user upload as many images as they
I'm looking for the best practice to solve the following situation: I've got an
I'm trying to find a design pattern or a best practice, or some other
I am looking for either a best practice, supported, guide from Microsoft or a
I am looking for a good design pattern, or best practice to achieve a
I'm looking for best-practice advice. I'm writing a small jQuery plugin to manage horizontal
I'm looking for a book/site/tutorial on best practices for relational database design, tuning for

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.