There is an entity which is called as the department, which has the attributes like name, and number, and location, and manager. Location is a multivalued attribute because both name as well as the number which are key attributes are specified as it’s been specified to be the unique. We can see the example in the below diagram for the department database:
Example for the department database as shown in the above diagram
Entity which is called as the dependent has the attributes employees, and dependent name, and birth date and relationship, as we can see the example in the below diagram:
Example for the entity is been shown above diagram so that it will be easy to understand.
Relationship
This will be pre own so that we can describe the relation between the two entities and the diamond or the rhombus will be pre own to represent the relationship. Let us consider an example as shown below diagram:
Diagram for the relationship shown above:
Types of relations which has been listed below:
- One to many relationship
- Many to many relationship
- Many to one relationship
- One to one relationship is kind of relationship where this type of relationship exists when there is only one occasion of any kind of the entity which is been associated with the relationship then its known as one-to-one relationship in the database
Lets consider an example: female to marry to one male and a male can marry to one female.
Again in the one to one relation we have categories like: mandatory – mandatory, optional – optional and optional-mandatory or mandatory- optional.
In most of the common relationship, type is one to one relationship in this record in one entity will be referred by the multiple in another entity.
Some more example for one-to-one relationship is been listed here:
- Person-fingerprint: in this example each of the person will have the unique set of finger prints and each set of finger prints will identify exactly to the one person.
- Email instance: in this instance for many of the websites one of the email address is been associated with exactly one user account and each user account is identified by its email address.
- Spouse-spouse: in this example in monogamous marriage one person will have to exactly one spouse.
Here the relationship in the Entity Relationship model will be expressed like all the relationships with line which is been bridge to the two entities so that the users can easily get the examples easily and understand it easily.
One cardinality which will be expressed by the single straight line which is been denoted by the crows’ foot symbol.
Perpendicular line which means that its mandatory, and the other possible is for one or both of the sides of the relationship which can be optional in the database
One to one relationship is the minimum frequent relationship type due to the very few one-to-one relationships which will exists, and moreover one to one relationship is one to one relationship only for some period of time only.
In the monogamous relationship it may be split up or one partner may die if this model has to be reality of monogamous relationship it needs to be model and the truth is that they will last only for the certain period of the time.
We would think that the person and their finger print will never be change but suppose if the person loses finger or the finger is badly been burnt then the finger print might change which is not frequent scenarios and, in some models, we may need to take this into the account, and suppose if One to one relationship in the table will be linked with only one row in table then the vice versa, this is not property of the data but its actually relationship itself.
Questions
- What is relationship? Explain its types
- Explain the other types of relationship with example