ER Models Entity-Relationship – Relationships, Cardinality, 1:n, n:m, Mapping
This article is a term explanation for ER models – including exam questions and tags.
In a Nutshell
ER models are graphical representations for visualizing data structures with entities, their attributes, and the relationships between them. They form the foundation for database design.
Compact Technical Description
Entity-Relationship models (ER models) were developed by Peter Chen to model data structures conceptually. They consist of three main components: entities (objects from the real world), attributes (properties of entities), and relationships (links between entities). Relationships have cardinalities that describe the number of possible links (1:1, 1:n, n:m). The most common notations are Chen notation and Crow’s Foot notation. ER models serve as a blueprint for creating relational databases and help avoid redundancies and ensure data integrity.
Exam-Relevant Key Points
- Entities: Real or abstract objects with unique identification
- Attributes: Properties of entities, primary and foreign keys
- Relationships: Links between entities with cardinalities
- Cardinalities: 1:1 (one-to-one), 1:n (one-to-many), n:m (many-to-many)
- Chen notation: Rectangles for entities, diamonds for relationships, ovals for attributes
- Crow’s Foot: Practical notation with lines and symbols for cardinalities
- Mapping: Transformation of ER models into relational schemas
- IHK relevant: Being able to interpret and create ER models
Core Components
- Entity types and entity instances
- Attributes (simple, composite, derived, multi-valued)
- Primary keys and foreign keys
- Relationship types and relationship instances
- Cardinalities and participations
- Weak entities and identifying relationships
- Generalization and specialization (inheritance)
- Aggregation and composition
- Chen notation vs. Crow’s Foot
- Mapping to relational tables
Practical Example
// ER Model Library (simplified)
ENTITY: Book
- ISBN (Primary key)
- Title
- Author
- Year
ENTITY: Customer
- CustomerNo (Primary key)
- Name
- Address
RELATIONSHIP: borrows (1:n)
- One customer can borrow many books
- One book can be borrowed by one customer
Mapping:
- Table Book(ISBN, Title, Author, Year, CustomerNo_FK)
- Table Customer(CustomerNo, Name, Address)
- Foreign key CustomerNo_FK in Book table
Advantages and Disadvantages
Advantages
- Visual representation facilitates understanding
- Early detection of design problems
- Standardized notations for communication
- Good foundation for database implementation
Disadvantages
- Complex models can become confusing
- Different notations can cause confusion
- Abstraction can hide important details
- Requires experience for good modeling
Typical Exam Questions (with Brief Answers)
-
Three main components of ER models? Entities, attributes, relationships.
-
Difference between 1:n and n:m relationships? 1:n: One record on one side can have many on the other side, but vice versa only one. n:m: Both sides can have many.
-
Chen notation symbols? Rectangles for entities, diamonds for relationships, ovals for attributes.
-
Crow’s Foot for 1:n relationship? Line with “foot” on the n-side, straight line on the 1-side.
-
Primary key vs. foreign key? Primary key uniquely identifies a record, foreign key refers to the primary key of another table.
-
Weak entity? Entity that cannot exist without another entity, identified by a foreign key.
-
Mapping of n:m relationship? Creates separate junction table with foreign keys to both involved entities.
-
Generalization in ER models? Special entities inherit from a general entity (IS-A relationship).
Most Important Sources
- https://de.wikipedia.org/wiki/Entity-Relationship-Modell
- https://www.guru99.com/er-diagram-tutorial.html
- https://www.lucidchart.com/pages/de/er-diagramme
Recommended Reading: Databases
Keine Bücher für Kategorie "datenbanken" gefunden.