ER-Diagram is a visual representation of data that describes how data is related to each other
Components of E-R Diagram
- Entity: Entity refers to a real world object that might depict a table in an SQL Server database. Databases are often constructed in the basis of an Entity-relationship diagram.
2.Weak Entity : In a relational database, weak entity is a entity that cannot be uniquely identified by its attributes, it should take the help of foreign key in conjunction with its attributes to create a primary key.
3. Attribute: It defines the properties of the table.or example, Name, Age, Address etc can be attributes of a Student.
4. Key Attribute: It represents the primary key in a particular entity/element
For example, id in the student entity type.
5. Non-Key Attribute: These are the attributes other than candidate key in a given table.For example in Name, First Name is non-Key Attribute which does not have the main characteristics of the entity.
6. Composite Attribute: In this type, all the attributes are arranged in a tree-structured way and every node is connected to its attribute.
Relationship:
It describes the bond between the entities.
There are generally three types of relationships:
1. Binary relationship
2. Recursive Relationship
3. Ternary Relationship
BINARY RELATIONSHIP
Binary Relationship means relation between two Entities. This is further divided into three types.
- One to One : This type of relationship is rarely seen in real world.
2. One to Many : It reflects business rule that one entity is associated with many number of same entity. The example for this relation might sound a little weird, but this means that one student can enroll to many courses, but one course will have one Student.
Many to One : It reflects business rule that many entities can be associated with just one entity. For example, Student enrolls for only one Course but a Course can have many Students.
RECURSIVE RELATIONSHIP
When an Entity is related with itself it is known as Recursive Relationship.
TERNARY RELATIONSHIP
Relationship of degree three is called Ternary relationship.
No comments:
Post a Comment