Solved

Understanding an Entity Relationship Diagram

Posted on 2014-01-29
2
537 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 42

Accepted Solution

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

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

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

690 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