ER Diagram to Database Scheme 1

For Complete YouTube Video: Click Here

In this class, we will understand the conversion of ER Diagram to Database Scheme 1.

We have already discussed the basic definitions of the database schema.

ER Diagram to Database Scheme 1

The image below is the final ER-Diagram that we have obtained.

ER Diagram to Database Scheme 1
ER Diagram to Database Scheme 1

From the above image, we will convert only employee entity type, department entity type, and the relationship type works_for marked in red into a database schema.

ER Diagram to Database Scheme 1 - Diagram 2
ER Diagram to Database Scheme 1 – Diagram 2

As discussed, an entity type and its attributes will get converted into a table and column of the tables.

In the database schema, we have to consider only simple attributes.

Composite or multivalued attributes should not be considered.

The image below shows the conversion of an employee entity type and its attributes into the relational schema of the database schema.

ER Diagram to Database Scheme 1 - Diagram 3
ER Diagram to Database Scheme 1 – Diagram 3

Similarly, the department entity type and its attributes get converted into the relational schema below.

Even though the location is a multivalued attribute we will use it in our database schema.

Later we will convert it.

ER Diagram to Database Scheme 1 - Diagram 4
ER Diagram to Database Scheme 1 – Diagram 4

Now we will convert the works_for relationship.

In the ER-Diagram conversion, the department attribute got converted into works_relationship, values of the department attribute are referencing the department.

In the database schema, we will convert the works_for relationship back into an attribute of an employee, and the relationship between the Dno of the employee table, Dnumber of the department table is done by drawing a line as shown below.

ER Diagram to Database Scheme 1 - Diagram 5
ER Diagram to Database Scheme

The relationship line states that the values of the employee’s Dno will reference the ‘values’ of the department’s Dnumber.