Solved

Understanding an Entity Relationship Diagram

Posted on 2014-01-29
2
510 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
2 Comments
 
LVL 41

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is ISQL? 6 126
Need way to extend view in MS Access 47 73
Online Forms 6 53
DBF to ... Converter 5 43
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

895 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

11 Experts available now in Live!

Get 1:1 Help Now