17
DBMS DESIGN  Date: 12 th May’2012 May 18, 2012 © 2008 W ipro Ltd - Confidential 1

Databse Design

Embed Size (px)

Citation preview

Page 1: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 1/17

DBMS DESIGN

Date: 12 th May’2012

May 18, 2012 © 2008 Wipro Ltd - Confidential 1

Page 2: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 2/17

Page 3: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 3/17

• Entity : Real-world object distinguishablefrom 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

Page 4: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 4/17

Super key, candidate key, and primary key

• Super key : a set of attributes that allowsto identify and entity uniquely in the entityset

• 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

ER Model Basics

Page 5: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 5/17

Step 1 :- Identifying the various entities of thesystem. First step is to identify the entities for thedatabase of your system. Entities are identifiedduring the conceptual design phase of databaseand application design. Entity could be anythingwhich has a distinct and separate existence (livingor non-living). The function that an entity plays ina relationship is called its role. Let’s take anexample of company:

Steps to develop a sample database

Page 6: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 6/17

COMPANY is an entity which has some characteristicslike department, vendors, location, etc. And anotherentity is EMPLOYEE with characteristics such asEmploy’s name its designation, etc and EMPLOYEE isrelated to the COMPANY as COMPANY gives salary tothe EMPLOYEE and takes work from EMPLOYEE.

Steps to develop a sample database

Page 7: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 7/17

Entity Set:An Entity Set is a set of entities of the same type,EMPLOYEE is the entity set with attributes orcharacteristics Name and Designation.

We can make a table with the help of abovediagramEMPLOYEE

Steps to develop a sample database

Page 8: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 8/17

Weak Entity Set :- A weak entity set does nothave a Primary key. A weak entity cannot beuniquely identified by its own attributes alone. Theexistence of a weak entity set depends on theexistence of an identifying entity set

• Strong Entity Set :-An entity set that has aprimary key is referred as a strong entity set.

Steps to develop a sample database

Page 9: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 9/17

Step 2 :- Identifying the relation between thediscovered 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 relationshipbetween entities. CUSTOMER and PRODUCT aretwo entities, CUSTOMER buys PRODUCT, and soBUYS is the relation in between CUSTOMER andPRODUCT.

Steps to develop a sample database

Page 10: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 10/17

Page 11: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 11/17

One entity can be associated with another entity viaa relationship set The mapping cardinality must beone of the following:• One-to-one•

One-to-many• Many-to-one• Many-to-Many

Steps to develop a sample database

Page 12: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 12/17

One-to-one

A customer is associated with at most one loan viathe relationship BORROWER A loan is associatedwith at most one customer by a relationship

BORROWER.

Steps to develop a sample database

Page 13: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 13/17

One-to-many

In the one-to-many relationship, a LOAN is associatedwith atmost one CUSTOMER by a relationship BORROWER, aCUSTOMERis associated with several loans by BORROWER.

Steps to develop a sample database

Page 14: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 14/17

Many-to-One

In the many-to-one relationship, a LOAN is associatedwith

several or none CUSTOMER via BORROWER, aCUSTOMER isassociated with at most one LOAN by BORROWER.

Steps to develop a sample database

Page 15: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 15/17

Many-to-ManyA CUSTOMER is associated with several or noneLOAN byBORROWER and a LOAN is associated with several or

noneCUSTOMER by relationship BORROWER.

Steps to develop a sample database

Page 16: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 16/17

Step 3 -Creating charts for interaction between theentities 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 therelationships among them with help of ER-Diagram.

Steps to develop a sample database

Page 17: Databse Design

7/31/2019 Databse Design

http://slidepdf.com/reader/full/databse-design 17/17

Thank You

May 18 2012 © 2008 Wipro Ltd Confidential 17