?
Solved

help with database relationships scenario  entity relationship diagram.

Posted on 2012-03-25
1
Medium Priority
?
652 Views
Last Modified: 2012-03-26
We are building a system that will have student, parent, and teachers using the system.

We want to the system to beable to show relationships between the users,  so on a student profile it would list their teachers, and parents,  Parents would see their students (child) and their teachers. Teachers would see their students, and the students parents details.  It's a long time since i did entity relationships  so very rusty.  

I have tables called

Users (user_id, firstname, lastname, address1,address2,city,zip,phone,email,password, created_at,updated_at)
teacher_users (id, user_id, student_id, parent_id, created_at, updated_at)
student_users(id, user_id, teacher_id, parent_id, created_at, updated_at)
parent_users (id, user_id, teacher_id, student_id, created_at, updated_at)

Do those table look correct ? and how would i define relationships,  many-many etc.

teacher_users,student_users,parent_users  have One user  Users has many Teachers, Students,Parents.

Teacher would see many students, 1 or 2 parents for that student.

student would see many teachers, and 1 or 2 parents.

parent would see many teachers and 1 or many students (might have a few kids)

How would i show these in a ERD ?
0
Comment
Question by:Jon Imms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
Sandeepratan earned 2000 total points
ID: 37764809
this can be achieved by using relates tables, u can refer below design

1. People ( id,name,address,other fileds)
2. RelationType (rel_id,name)  (example 1,'teacher',  2,'parent'
3. PeopleRelats (id1,id2, relationid)
 
this is basic layout, you can extend the same for specific relations
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question