Solved

help with database relationships scenario  entity relationship diagram.

Posted on 2012-03-25
1
646 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:jonathan1978
1 Comment
 
LVL 2

Accepted Solution

by:
Sandeepratan earned 500 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
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…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now