Вы находитесь на странице: 1из 17

DBMS DESIGN

Date: 12th May2012

May 18, 2012

2008 Wipro Ltd - Confidential

The Entity-Relationship Model


The E-R model is a detailed, logical representation of the data for an organisation or business area It should be understandable to both the user and to the IT technologist It must be flexible enough so that it can be used and understood in practically any environment where information is modelled

ER Model Basics
Entity: Real-world object distinguishable from other objects. An entity is described (in DB) using a set of attributes. Entity Set: A collection of similar entities. E.g., all employees. Each entity set has a key. Key and key attributes Key: a unique value for an entity Key attributes: a group of one or more attributes that uniquely identify an entity in the entity set

ER Model Basics
Super key, candidate key, and primary key Super key: a set of attributes that allows to identify and entity uniquely in the entity set Candidate key: minimal super key There can be many candidate keys Primary key: a candidate key chosen by the designer Denoted by underlining in ER attributes

Steps to develop a sample database


Step 1:- Identifying the various entities of the system. First step is to identify the entities for the database of your system. Entities are identified during the conceptual design phase of database and application design. Entity could be anything which has a distinct and separate existence (living or non-living). The function that an entity plays in a relationship is called its role. Lets take an example of company:

Steps to develop a sample database


COMPANY is an entity which has some characteristics like department, vendors, location, etc. And another entity is EMPLOYEE with characteristics such as Employs name its designation, etc and EMPLOYEE is related to the COMPANY as COMPANY gives salary to the EMPLOYEE and takes work from EMPLOYEE.

Steps to develop a sample database


Entity Set: An Entity Set is a set of entities of the same type, EMPLOYEE is the entity set with attributes or characteristics Name and Designation. We can make a table with the help of above diagram EMPLOYEE

Steps to develop a sample database


Weak Entity Set :- A weak entity set does not have a Primary key. A weak entity cannot be uniquely identified by its own attributes alone. The existence of a weak entity set depends on the existence of an identifying entity set Strong Entity Set:-An entity set that has a primary key is referred as a strong entity set.

Steps to develop a sample database


Step 2:- Identifying the relation between the discovered entities in step 1. Entity Relationship Model says that divide your database in two logical parts, entities and relations. Next step is to identify the relationship between entities. CUSTOMER and PRODUCT are two entities, CUSTOMER buys PRODUCT, and so BUYS is the relation in between CUSTOMER and PRODUCT.

Steps to develop a sample database


A relationship is an association among several entities.

Steps to develop a sample database


One entity can be associated with another entity via a relationship set The mapping cardinality must be one of the following: One-to-one One-to-many Many-to-one Many-to-Many

Steps to develop a sample database


One-to-one

A customer is associated with at most one loan via the relationship BORROWER A loan is associated with at most one customer by a relationship BORROWER.

Steps to develop a sample database


One-to-many

In the one-to-many relationship, a LOAN is associated with at most one CUSTOMER by a relationship BORROWER, a CUSTOMER is associated with several loans by BORROWER.

Steps to develop a sample database


Many-to-One In the many-to-one relationship, a LOAN is associated with several or none CUSTOMER via BORROWER, a CUSTOMER is associated with at most one LOAN by BORROWER.

Steps to develop a sample database


Many-to-Many A CUSTOMER is associated with several or none LOAN by BORROWER and a LOAN is associated with several or none CUSTOMER by relationship BORROWER.

Steps to develop a sample database


Step 3-Creating charts for interaction between the entities along with their relationships. (E-R Diagrams) Now in this step we design the entity relationship diagram of our database for our application, it is possible to define a set of entities and the relationships among them with help of ER-Diagram.

Thank You

May 18, 2012

2008 Wipro Ltd - Confidential

17