What is a Relationship?
An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and these entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in a database, so by showing relationships among tables and their attributes, ER diagram shows the complete logical structure of a database.
How do identify a relationship in ER diagram?
There are three types of relationships that can exist between two entities. An entity-relationship (ER) diagram can be created based on these three types, which are listed below:
- one-to-one relationship: In relational database design, a one-to-one (1:1) relationship exists when zero or one instance of entity A can be associated with zero or one instance of entity B, and zero or one instance of entity B can be associated with zero or one instance of entity A. (abbreviated 1:1)
- one-to-many relationship: (abbreviated 1:N) In relational database design, a one-to-many (1:N) relationship exists when, for one instance of entity A, there exists zero, one, or many instances of entity B; but for one instance of entity B, there exists zero or one instance of entity A.
- many-to-many relationship: In relational database design, a many-to-many (M:N) relationship exists when, for one instance of entity A, there exists zero, one, or many instances of entity B; and for one instance of entity B, there exists zero, one, or many instances of entity A. (abbreviated M:N)
One-on-one partnerships are hard to come by in the professional world. On the other hand, one-to-many and many-to-many relationships are widespread. Many-to-many relationships, on the other hand, are not permitted in a relational database and must be changed to one-to-many relationships, as will be detailed later. Tables in one-to-many connections make up the majority of relational databases.
Types of Constraints
Limit the number of possible combinations of entities that may participate in a relationship set. There are two types of constraints:
- cardinality ratio
- participation constraints.
Relationships of Salon BETA
One-to-One relationships |
||
Salon_Beta |
maintain |
Inventory |
(Inventory is maintained by Salon_Beta) |
||
Cashier |
maintain |
Inventory |
(Inventory is maintained by Cashier) |
||
Salon_Beta |
maintain |
Cashier |
(Salon_Beta maintain Cashier) ____________________________________________________________________ |
||
One-to-Many relationships |
||
Salon_Beta |
maintain |
Employee |
(Employees are maintained by Salon_Beta ) |
||
Customer |
pay |
Cashier |
(Customers pay to the Cashier) ____________________________________________________________________ |
||
|
|
|
Many-to-Many relationships |
||
Employee |
supply |
Service |
(Employees supply Services) |
||
Customer |
book |
Service |
(Customers book Services) |
***
0 Comments