+ All Categories
Home > Education > Dbms chapter iv

Dbms chapter iv

Date post: 12-Nov-2014
Category:
Upload: bala-ganesh
View: 119 times
Download: 2 times
Share this document with a friend
Description:
 
18

Click here to load reader

Transcript
Page 1: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Chapter IV

Page 2: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Models• A collection of tools for describing

– Data – Data relationships– Data semantics– Data constraints

• Relational model• Entity-Relationship data model (mainly for database design) • Object-based data models (Object-oriented and Object-relational)• Semistructured data model (XML)• Other older models:

– Network model – Hierarchical model

Page 3: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Models

• A collection of Conceptual tools for describing – Data – Data relationships– Data semantics– Data constraints

• Different data Models• - Relational model - Entity-Relationship data model (Conceptual Model-mainly for database design)

- Object-based data models (Object-oriented and Object-relational) - Semi structured data model (XML)• Other older models:

– Network model – Hierarchical model

A Data model is a set of concepts that can be used to describe the structure of the db.

Page 4: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Entity-Relationship data model

• It is a high level conceptual data model that describes the structure of db in terms of entities, relationship among entities & constraints on them..

• Basic Concepts of E-R Model: - Entity- Entity Set- Attributes- Relationship- Relationship set- Identifying Relationship

I

Page 5: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Entity-Relationship data model

• Entity:-It is a an object that exists in the real world.

• Example: - Person, Employee, Car, Home etc..

Object with conceptual Existence - Account, loan, job etc…

Page 6: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Entity-Relationship data model

• Entity Set: - A set of entities of the same type.• Attributes:

- A set of properties that describe an entity.

Page 7: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• Types of Attributes:• Simple (or) atomic vs. Composite:• - An attribute which cant be sub divided. (Eg.Age)• - An attribute which can be divided into sub parts is called • as composite attribute.

e.g.. Address- Apartment no. - Street

- Place - City

- DistrictSingle Valued vs. Multivalued:• -An attribute having only one value (e.g.. Age,eid,sno) • - An attribute having multiple values (e.g.. Deptlocat- A dept can be located in

several places)

Entity-Relationship data model

Page 8: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Entity-Relationship data model

• Stored Vs Derived• - Stored attribute is one that has some value where as

derived attribute is a one where its value is derived from sa.• -E.g.. SA-DOB• DA- Age derived from DOB.• Key Attribute:• - An attribute which is used to uniquely identify records.• E.g.. eid, sno, dno

Page 9: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Entity-Relationship data model

• Relationship:• - It is an association among several

entities. It specifies what type of relationship exists between entities.

Page 10: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• Relationship set:• - It is a set of relationships of the same type.

Entity-Relationship data model

1 AA 1000

2 BB 2000

100 FFF 10000

1 AA AC

2 BB AD

100 FFF SD

EntityENTITY SET

DEPT. ENTITY TYPERelationship SetEmp.. ENTITY TYPE

Page 11: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• Weak Entity Set:• - No key attributes.• Identifying Relationship:• - The relationship associated with the weak

entity type

Entity-Relationship data model

Page 12: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

Constraints

• Two of the most important constraints are

• a. Mapping Constraints• b. Participation constraints

»Participation constraints

Total Participation Partial Participation

Page 13: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

a. Mapping Cardinalities:Mapping Cardinalities OR CARDINALITY RATIOS, EXPRESSS THE NUMBER OF

ENTITIES TO WHICH ANOTHER ENTITY CAN BE ASSOCIATED VIA A RELATIONSHIPSET.

• Several types of Mapping Cardinalities. They are,• a.i. One-to-One• An entity in set A is associated with at most one entity in set B and

vice versa.

e1

e2

e3

d1

d2

d3

Employee Dept.Works for

Page 14: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• a.i. One-to-many• An entity in set A is associated with zero or more

no. of entities in set B and an entity in B is associated with at most one entity in A.

a. Mapping Cardinalities:

e1

e2

e3

d1

d2

d3

Employee Dept.Works for

Page 15: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

a. Mapping Cardinalities: a.i. Many-to-One One or more no. of entities in set A is associated with at

most one entity in B. An entity in B can be associated with any no. of entities in A.

e1

e2

e3

e4

d1

d2

d3

Employee Dept.Works for

Page 16: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• a.i. Many-to-Many• One or more no. of entities in set A

is associated with one or more no. of entities in set B.

a. Mapping Cardinalities:

e1

e2

e3

e4

d1

d2

d3

Employee Dept.Works for

Page 17: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

• The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in atleast one relationship in R.

b. Participation Constraints:Total Participation

Partial Participation:The participation of an entity set E in a relationship set R is said to be partial if only a few of the entities in E participated in relationship in R.

Page 18: Dbms chapter iv

Subject Name Code Credit HoursDatabase System COMP 219 3

b. Participation Constraints:

• E.G..

Partial participation Total participation

EmployeeDept.

Manages


Recommended