[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Understanding an Entity Relationship Diagram

Posted on 2014-01-29
2
Medium Priority
?
554 Views
Last Modified: 2014-02-01
I am new to databases and am trying to follow an Entity Relationship Diagram (attached). I cannot see how this could be implemented in real life. If you were querying the 'GPA' of a particular student how would you know whether to search in the 'UNDERGRADUATE' or the 'GRADUATE' table. Grateful for any assistance.ERD
0
Comment
Question by:tigger_ranelagh
[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
2 Comments
 
LVL 43

Accepted Solution

by:
pcelba earned 2000 total points
ID: 39819556
This ERD means:
Every student (identified by StudentID) can have zero or more records in two child tables.

It is exactly as in the real life. Every people can attend no one, one, or more schools. Schools are divided into two levels in above ERD (you may add possible missing levels).

The connection line between two tables means what is above written:  Student has ONE record in STUDENT table and zero or more records in each of the two child tables.

If you need to query all GPAs for one student then you have to use UNION query:

SELECT HighSchoolGPA FROM UNDERGRADUATE WHERE StudentID = 5
UNION
SELECT UnderGraduateGPA FROM GRADUATE WHERE StudentID = 5

If you need to distinguish between HighSchoolGPA and UnderGraduateGPA in the result then you have to add one more column on output:

SELECT 'H' as GPAtype, HighSchoolGPA FROM UNDERGRADUATE WHERE StudentID = 5
UNION
SELECT 'U' as GPAtype, UnderGraduateGPA FROM GRADUATE WHERE StudentID = 5

More info about ERD: http://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model

More info about SQL language: http://www.w3schools.com/sql/default.asp
0
 

Author Closing Comment

by:tigger_ranelagh
ID: 39826202
Many thanks for a very clear explanation.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

649 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