...

/

ER Modeling Basics

ER Modeling Basics

Understand the Entity-Relationship (ER) model is and why it’s critical.

We'll cover the following...

Imagine trying to build a house without a blueprint.

We might end up with a door that leads nowhere or a kitchen without a sink! The same principle applies to databases. We need a solid design before we write any code. In the case of building a new e-commerce system like our OnlineStore database, one of the first challenges is figuring out how to represent the real-world scenario in a structured way.

Here, we need to store information about customers, products, suppliers, and orders - and we want it to be easy to query, update, and maintain.

This is where Entity-Relationship (ER) modeling comes in. It's the architectural blueprint for our data, ensuring everything has a logical place and connects correctly. ER modeling helps us capture the essential elements of the system and their relationships before we write any code or create tables.

By the end of this lesson, we’ll be able to:

  • Understand what an Entity-Relationship (ER) model is and why it’s a critical first step.

  • Identify and define entities, which are the main objects in our database.

  • Describe the different kinds of attributes that give entities their characteristics.

  • Explain the role of identifiers in making sure every piece of data is unique.

Entity-Relationship model

Before writing any CREATE TABLE statements, it’s important to first understand the data you’re working with.

Jumping straight into coding without a clear plan can lead to poorly structured data, making your database difficult to use, maintain, and scale. A solid plan not only saves time but also prevents future issues. One of the most effective ways to create a plan is by using an Entity-Relationship (ER) model.

This is a high-level, visual blueprint of your database, showing your data as entities (things) and relationships (connections) between them.

Think of the ER model as a conceptual map. It helps ...