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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:26:15+00:00 2026-06-15T10:26:15+00:00

Try to get some professional idea here about which choice is better when creating

  • 0

Try to get some professional idea here about which choice is better when creating schema relationships

I roughly find an idea from this post but still try to get more thinkings.

A simple scenario could be like this:

class <--> Student <--> Teacher <--> class

(Assume a teacher can teach multiple classes)
it is a normal scenario with many-to-many relationship in a round. And query can start from any peer to any direction. So what could be a better design?

I know in one to one relationship a mapping table is definitely a waste, but is the mapping table solution ONLY good for many-to-many relationship, like that post mentioned? If we want to extend the many to many relationship with directions. If the relationship is one-direction instead of bidirectional, could the answer be different?

Thanks in advance.

  • 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-06-15T10:26:16+00:00Added an answer on June 15, 2026 at 10:26 am

    Some simple rules:

    For a one-to-one relationship, a foreign key can be held in either of the tables involved in the relationship, referencing the other table.

    For a one-to-many relationship, the table on the many side of the relationship should hold the foreign key.

    For a many-to-many relationship, you can create an association table (mapping table in your terms), which is a third table that holds foreign keys to both of the tables involved in the many-to-many relationship.

    For example, assume we have the tables STUDENT, CLASS, and TEACHER. Generally, there is a many-to-many relationship between STUDENT and CLASS, and a one-to-many from TEACHER to CLASS (assuming a class only has one teacher). So, these tables might look like:

    STUDENT: STUDENT_ID, STUDENT_NAME, etc.
    CLASS: CLASS_ID, TEACHER_ID (foreign key), CLASS_NAME, etc.
    TEACHER: TEACHER_ID, NAME, etc.
    STUDENT_CLASS (mapping table): STUDENT_ID (foreign key), CLASS_ID (foreign key), GRADE, etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to get some data about a city using Sparql query on DBpedia.
Every time I try to get some information about my video files with ffmpeg,
I try to get some website attribute (colour of the cell) and compare in
I try to get some insights from the pages I am administrator on Facebook.
For some reason if I try to get the actual size of mystruct I
I am working on some scraping app, i wanted to try to get it
I try to replace few characters in some string 14/04/2010 17:12:11 and get, for
When I try to install my software in some computers, I used to get
i'm working on google analytics and try to get some data from analytics. What
Hi i am trying to get some data about a socket client connecting to

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.