Relationship and their types | Data models
RELATIONSHIPS AND RELATIONSHIP SETS
INTRODUCTION OF RELATIONSHIPS-
After two or more entities are identified and defined with attributes, the participants determine if a relationship exists between the entities. A relationship is any association,linkage, or connection between the entities of interest to the business; it is a two-directional, significant association between two entities, or between an entity and itself.Each relationship has a name, an optional (optional or mandatory), and a degree (how many).
A relationship is described in real terms.Relationship represents an association between two or more entities.Entities enrolled in a relationship are called its participants
EXAMPLE- Employees are assigned to projects
Projects have sub-tasks
Departments manage one or more projects
TYPES OF RELATIONS-
1.) 1:M(One to many)-In a one-to-many relationship, each row in the related to table can be related to many rows in the relating table. This allows frequently used information to be saved only once in a table and referenced many times in all other tables.
EXAMPLE-In class there is only one faculty member and there are number of children. This is an example of one to many relationship.
(ONE-MANY RELATIONSHIP)
2.)M:M (Many to many relationship)-A many-to-many relationship refers to a relationship between tables in a database when a parent row in one table contains several child rows in the second table, and vice versa. Many-to-many relationships are often tricky to represent.
EXAMPLE- There are so many skills of a person and its vice versa.
(MANY-MANY RELATIONSHIP)
3.) M:1(Many to one relationship)- A many-to-one relationship is where one entity (typically a column or set of columns) contains values that refer to another entity (a column or set of columns) that has unique values. In relational databases, these many-to-one relationships are often enforced by foreign key/primary key relationships, and the relationships typically are between fact and dimension tables and between levels in a hierarchy.
EXAMPLE- In any company there are no of stores and for one store there should be one head employee.
4.) 1:1(One to one relationship)-In a one-to-one relationship, each row in a table is related to a single row in another table.
EXAMPLE-
In a warehouse application a storage-bin table might have a one-to-one relationship with a widget table. This application would model a physical warehouse where each storage bin contains one type of widget and each widget resides in one storage bin.
0 comments:
Post a Comment