# ERD

Entity Relationship Diagram (ERD)

To design a relational database, you first create an Entity Relationship Diagram. In this, you model the data that the user wants to store, without looking at the technical implementation. The following concepts play a role in an ERD:

* Entity: a type of "thing" about which the user wants to store data, for example a user, an order, or a student.
* Attribute: properties of an entity. For a user, this could be: username, email, and password.
* Relationships: connection between entities, for example the fact that one customer can place multiple orders.
* Instances: an example of an entity, for example the order with order number 239741.

* 1-to-many (1: N): one instance can belong to multiple instances of another entity. For example: a customer can place multiple orders, but an order belongs to only one customer.
* many-to-many (N: M): one instance can belong to multiple instances of another entity, but the reverse is also true. For example: an order can contain multiple products and conversely a product can appear on multiple orders.
* 1-to-1 (1:1): one instance belongs to a maximum of one instance of another entity. For example: an employee can have one lease car and a lease car is from one employee.

![ERD](../assets/ERD.png)