Lecture 5 - Entity Relationship Diagram



ERD is a way of representing database relations in a graphical form. As you know that the entities are represented using rectangle and attributes using ovals.

Let’s revisit the relationship of a teacher and student. As you can see that one teacher teaches many students.

First Relation


 

Second Relation


Similarly, many subjects are studied by many students.



Merge Relations

 

 

 Now! You must be thinking what is the relationship of teacher and subject? Probably your answer is many-to-many . . .

I would rather disagree with your point of view; the reason will be discussed with you when we would implement this ERD in a DBMS. The completed ERD would be

Finalized Relations




That was simple ERD; it cannot be implemented in any DBMS. What else is required? What is missing? Do you remember the term ‘attribute’? Yes the answer is ‘attributes’ which are not defined.

Let’s define some attributes


Now there should be some relationship among these entities. The assignment is yours . . .

Comments

Popular posts from this blog

Lecture 17 – Functions (continued)

Lecture 6 – Operators in C (continued)

Lecture 10 – Decisions (if-else-if)