-->
Showing posts with label E-R model/diagram. Show all posts
Showing posts with label E-R model/diagram. Show all posts

Explain E-R diagram with example.

Explain E-R diagram with example.

ans:-

The Entity-Relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. For example, each person is an entity, and bank accounts can be considered as entities.
Entities are described in a database by a set of attributes. For example, the attributes account-number and balance may describe one particular account in a bank, and they form attributes of the account entity set. Similarly, attributes customer-name, customer-street address and customer-city may describe a customer entity.
A relationship is an association among several entities. For example, a depositor relationship associates a customer with each account that she has. The set of all entities of the same type and the set of all relationships of the same type are termed an entity set and relationship set, respectively.
The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram, which is built up from the following components:
  • Rectangles, which represent entity sets
  • Ellipses, which represent attributes.
  • Diamonds, which represent relationships among entity sets.
  • Lines, which link attributes to entity sets and entity sets to relationships.

for example,

E-R can have following types.
one-to-one
one-to-many
many-to-many