Before you create tables, you decide what the database must store. The entity-relationship (ER) model is the tool for that step. It has three parts: entities, attributes and relationships. This lesson is about the first two.
Entities
An is one thing that you can tell apart from all others: one member of a library, one book. An entity set is all entities of the same type: all members.
Attributes
An attribute is one fact about each entity of a set. Attributes come in different kinds:
| Kind | Means | Example |
|---|---|---|
| simple | cannot be split into smaller parts that you use | birth_date |
| composite | made of parts that you also use alone | name = first_name + last_name |
| single-valued | one value per entity | birth_date |
| multivalued | a set of values per entity | phone_number |
| derived | calculated from other attributes, so not stored | age |
| key | identifies each entity in the set | card_number |
In an ER diagram, the key attribute is underlined. Textbooks mark a multivalued attribute with braces and a derived attribute with () after its name.