course content

Course Content

Relational Database and Normalization

Entity-Relationship ModelEntity-Relationship Model

Databases can vary in size, containing different numbers of tables and relationships. This is why diagrams are utilized when creating databases, as they visually depict the database structure.

Let's familiarize ourselves with the most widely used diagram in database design - the entity-relationship model (ER model). Here's an example:

Here, we have two entities: School and Student. The School entity has attributes such as id, name, and location, while the Student entity has attributes such as id, name, and surname. A relationship between the Student and School entities exists - called "study".

We can represent it in relational databases’ tables with the foreign key:

The relationship “study” was represented like the foreign key (school_id column).

The models help to create a database structure.

Concepts

"There are three fundamental concepts in the ER model:

  • Entities - real or abstract objects, such as schools and students.
    Shape: Rectangle.
  • Attributes - characteristics or parameters for entities (e.g., location, founding year for a school, age, group for a student, etc.).
    Shape: Ellipse (Circle).
  • Relationships - types of interactions between entities or attributes.
    Shape: Rhombus.

You can view the shapes of these components in the following picture:"

Modern Entity-relation diagram presentation

Attribute shapes occupy a considerable amount of space. Therefore, these diagrams can be represented in another version:


Here, you can see a one-column table where the header represents the entity and the rows correspond to the attributes of this entity.

question-icon

Choose the shapes:

The Entity shape is
_ _ _
.

The Attribute shape is
_ _ _
.

The Relationship shape is
_ _ _
.

Click or drag`n`drop items and fill in the blanks

dots
Elipse (Circle)
dots
Line
dots
Rhombus
dots
Rectangle
down-icon

Section 1.

Chapter 3