Lecture 4 - Database Design Process



Before we can design a database, we need to learn some important concepts related to it.

Entity


An entity is anything for which data is stored and maintained. For example: Student, Teacher, Player, Customer, Order, Course, Department etc. Diagrammatically they are represented as a rectangle.

Attribute


Properties of an entity are called its attributes. For example Student’s attributes are AdmNo, Name, Father’s Name etc. Diagrammatically they are represented by an oval.

Relationship


A logical connection between entities is called a relationship.

Cardinality


The types of relationship between entities, following are the types of relationships between the entities.

One-to-One


In one-to-one relationship only one instance of an entity is related to only one instance of another entity.


 
 
Figure 2 - One-to-One Relationship

One-to-Many


In one-to-many type of relationship one instance of first entity is related to many instances of other entity.


Figure 3 - One-to-Many Relationship

Many-to-Many


In this type of relationship many instances of an entity are related to many instances of other entity.



Figure 4 - Many-to-Many Relationship

Representing Cardinalities


There are different methods to represent different cardinalities. Let’s look at one-to-one relationship first.

Representing one-to-one relationship


Entities are represented as rectangles. The maximum cardinality is marked adjacent to the entity. Similarly, minimum cardinality is marked away from the entity.



Figure 5 - Representing One-to-One Relationship

Representing one-to-many relationship


The process is similar to representing one-to-one relationship, with a slight difference that is the use of ‘many’ operator.


Figure 6 - Representing One-to-Many Relationship

Representing many-to-many relationship


The process is similar to representing one-to-many relationship, with the use of ‘many’ operator with both entities.


Figure 7 - Representing many-to-many relationship

Comments

Popular posts from this blog

Lecture 17 – Functions (continued)

Lecture 6 – Operators in C (continued)

Lecture 10 – Decisions (if-else-if)