0% found this document useful (0 votes)
2 views

Unit-2-DAY 6_24_09

This document outlines guidelines for teaching data analysis and modeling techniques, focusing on Entity-Relationship (ER) models, keys, and constraints. It covers topics such as cardinality ratios, participation constraints, and the distinction between primary and foreign keys, as well as advanced concepts like specialization and generalization in Extended ER diagrams. The content is intended for training purposes and contains proprietary information from ABES Engineering College.

Uploaded by

mailing2chinka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Unit-2-DAY 6_24_09

This document outlines guidelines for teaching data analysis and modeling techniques, focusing on Entity-Relationship (ER) models, keys, and constraints. It covers topics such as cardinality ratios, participation constraints, and the distinction between primary and foreign keys, as well as advanced concepts like specialization and generalization in Extended ER diagrams. The content is intended for training purposes and contains proprietary information from ABES Engineering College.

Uploaded by

mailing2chinka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 47

Quality Content for Outcome based Learning

Keys
Unit2 _Day 6

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


General Guideline
© (2021) ABES Engineering College.

This document contains valuable confidential and proprietary information of ABESEC. Such confidential and
proprietary information includes, amongst others, proprietary intellectual property which can be legally protected and
commercialized. Such information is furnished herein for training purposes only. Except with the express prior
written permission of ABESEC, this document and the information contained herein may not be published,
disclosed, or used for any other purpose.

2
Copyright © 2021, ABES Engineering College
Chapter Objective

Describe use and apply data analysis and Modelling Techniques i.e. data modelling

To apply Binary Relationship Constraints

Describe the fundamental Elements of ER Model

To understand the concept of Keys

To Explain the Extended E- R concepts

Convert the ER model to relational table in populated relation


database
3
Copyright © 2021, ABES Engineering College
Topics Covered

Day 1 Day 2 Day 3 Day 4


• Introduction • Constraints • Completion • Reduction of
Case Study- on Binary of ER model an ER Model
User Relationship • Reduction of to an
Requirement Types an ER Model Relational
• Basic • Keys to an Table
Concept of • Primary Relational (Cont.).
ER Model • Foreign key Table • Complete
• ER • Extended ER Relational
Modelling Concept Model of
• Entities Case Study
• Attributes
• Relationship

4
Copyright © 2021, ABES Engineering College
Constraints on Binary Relationship Types

 Relationship types usually have certain constraints that limit the possible combination of entities
that may participate in the corresponding relationship set.

 These constraints are determined from the real-world situation that the relationships represent.

 For example, a student can be part of exactly one department, and then we would like to
describe this constraint in the database design.

5
Copyright © 2021, ABES Engineering College
Cardinality Ratio
 The cardinality ratio expresses the number of entities to which another entity can be associated
via a relationship set.

 For a binary relationship type R between entity types A and B, the mapping cardinality must be
one of the following:
 One-to-one
 One-to-many
 Many-to-one
 Many-to-many

6
Copyright © 2021, ABES Engineering College
Cardinality Ratio (Cont.)

1) One-to-one. An entity in A is associated with at most one entity in


B, and an entity in B is associated with at most one entity in A.

Representation of One-To-One Cardinality Entity-relationship showing One-To-One


Cardinality

7
Copyright © 2021, ABES Engineering College
Cardinality Ratio (Cont.)

2) One-to-many. An entity in A is associated with any number (zero or more) of entities in B. An


entity in B, however, can be associated with at most one entity in A.

Representation of One-To-Many Cardinality Entity-relationship showing One-To-Many Cardinality

8
Copyright © 2021, ABES Engineering College
Cardinality Ratio (Cont.)

3) Many-to-one. An entity in A is associated with at most one entity in B. However, an entity in B can
be associated with any number (zero or more) of entities in A.

Representation of Many-To-One Cardinality Entity-relationship showing Many-To-One Cardinality

9
Copyright © 2021, ABES Engineering College
Cardinality Ratio (Cont.)

4) Many-to-many. An entity in A is associated with any number (zero or more) of entities in B, and
an entity in B is associated with any number (zero or more) of entities in A.

Representation of Many-To-Many Cardinality Entity-relationship showing Many-To-Many Cardinality

10
Copyright © 2021, ABES Engineering College
Can we answer?

 An entity in A is associated with at most one entity in B, and an entity in B is


associated with at most one entity in A.
a. One to many
b. One to One
c. Many to Many
d. Many to One

11
Copyright © 2021, ABES Engineering College
Limit on Cardinality Ratio

 ER diagrams also provide a way to indicate more complex constraints on the number of times
each entity participates in relationships in a relationship set.

 An edge between an entity set and a binary relationship set can have an associated minimum and
maximum cardinality.

 This is shown in the form l..h, where l is the minimum and h the maximum cardinality.

12
Copyright © 2021, ABES Engineering College
Limit on Cardinality Ratio (Cont.)

Example: Faculty are supposed to work on research projects. One faculty can work on Zero or a
maximum of three research projects. A research project can have a minimum of one and a maximum
of any number of faculty members.

Entity-relationship showing Limits on Cardinality Ratio

13
Copyright © 2021, ABES Engineering College
Can we answer?

 ……………………. Is the restriction imposed to maintain data integrity of the


database.
a. Mapping Cardinalities
b. Cardinality ration
c. Participation constraints
d. All of the above

14
Copyright © 2021, ABES Engineering College
Can we answer?

 For Binary relationship set R between entity set A and B, the express number
of entities to which another entities ca be associated.
a. Cardinality Ratio
b. Participation Constraints
c. Limited Ratio
d. Degree Ratio

15
Copyright © 2021, ABES Engineering College
Participation Constraints & Existence Dependencies

 The participation of an entity set E in a relationship set R is said to be


total if every entity instance in E participates in at least one
relationship in R.

 If only some entities in E participate in relationships in R, the


participation of entity set E in relationship R is said to be partial.

 Total participation is also called existence dependency.

16
Copyright © 2021, ABES Engineering College
Total and Partial Participation

 In an ER diagram, total participation is shown by double lines,


which indicates the total participation of an entity set in a relationship
set & partial participation is shown by a single line which indicates
the partial participation of an entity set in a relationship set.

Entity relationship showing partial (single line) and total


participation (double lines)

17
Copyright © 2021, ABES Engineering College
Identifying relationship type

 A weak entity type always has a total participation constraint (existence


dependency) with respect to its identifying entity type because a weak entity type
cannot exist without an owner (identifying) entity type.

 The relationship associating the weak entity type with its identifying entity type is
called the identifying relationship type. Identifying relationship type is shown by
a double outlined diamond symbol.

Entity relationship showing identifying relationship


(double outlined diamond)
18
Copyright © 2021, ABES Engineering College
Question

 Let E be an entity set in a relationship set R. If every entity in E


participates in at least one relationship in R, then participation of E
in R is…………………
a. Partial
b. Total
c. Complete
d. Incomplete

19
Copyright © 2021, ABES Engineering College
Question

 Total participation of an entity in a relationship set is


represented using……….
a. Double line
b. Single line
c. Double rectangle
d. Dashed line

20
Copyright © 2021, ABES Engineering College
Question

 How are roles specified in an ER diagram


a) By labeling the rectangles
b) By labeling the diamonds
c) Roles cannot be specified in an ER diagram
d) By labeling the lines

21
Copyright © 2021, ABES Engineering College
Question

 State true or false: Every weak entity set must be associated with
an identifying entity
a) True
b) False

 State true or false: A weak entity can participate in all the


relationships.
a) True
b) False

22
Copyright © 2021, ABES Engineering College
Explain following diagrams

a.

b.

23
Copyright © 2021, ABES Engineering College
Explain following diagrams

c.

d.

24
Copyright © 2021, ABES Engineering College
Quality Content for Outcome based Learning

Session 2:- Introduction to Keys

Topics to be covered

• Keys
• Primary
• Foreign key
• Extended ER diagram
Ver. No.: 1.1 Copyright © 2021, ABES Engineering College
Keys

A key is an attribute or a set of attributes of an entity type that help


to uniquely identify an entity instance in an entity set and is also
used to establish relationships between the different entity types.

Two important types of keys are discussed here.

 Primary Key
 Composite Primary Key
 Foreign Key

26
Copyright © 2021, ABES Engineering College
Primary Key

A Table column(s) with the following set of features can be


designated as the primary key. A Table can have one and only one
primary key.
 Its value can never be NULL.
 Its value is always unique for each instance.
 The value once provided cannot be changed
Or become NULL during lifetime of entity.

In given diagram emp_id is


Primary Key

27
Copyright © 2021, ABES Engineering College
Composite Primary Key

 In case a table does not have a single table column that can
identify table rows uniquely, we have to combine two or more
table columns to make the key.
 This combination of two or more table columns that can be used to identify table
rows uniquely is called the composite key or composite primary key.

Note: A table can have only one Primary key .

28
Copyright © 2021, ABES Engineering College
Foreign Key
A primary key of a Table is called a foreign key to some other Table when that
column is used to relate the two Tables.

29
Copyright © 2021, ABES Engineering College
Foreign Key

30
Copyright © 2021, ABES Engineering College
Foreign Key

31
Copyright © 2021, ABES Engineering College
Question

 Identify primary key and foreign keys?

32
Copyright © 2021, ABES Engineering College
Identify primary key and foreign keys?

33
Copyright © 2021, ABES Engineering College
Identify primary key and foreign keys?

 Q1:
Students( id, name)
Grades ( Student_id, grades, course_id)
Course (id, name).

 Q2:
Customers (Cust_id, cust_name, Cust_street, Cust_city, Cust_pincode)
Orders (Order_no, customer_id, order_date, ship_date, emp_no )
Employee (Employee_no, name, position, hourly_rate)

34
Copyright © 2021, ABES Engineering College
Questions!!!!!!
 A Key which is a set of one or more columns that can identify a
record uniquely is called?
a) Natural key
b) Candidate key
c) Not Null key
d) Alternate key

 Which key accepts multiple NULL values?


a) Foreign Key
b) Unique Key
c) Primary Key
d) None of the Mentioned
35
Copyright © 2021, ABES Engineering College
Extended ER Diagram / Enhanced ER diagram
(EER)

Is needed to design accurate database schemas that reflect data properties and
constraints more precisely.
Applications: CAD/CAM, Telecommunications, GIS etc…

This lead to the development of additional semantic data modelling concepts


which is incorporated in conceptual data models termed as EER ( Extended ER ).
It includes the following concepts:
Specialization/Generalization
Attribute Inheritance
Constraints on Specialization/Generalization.

36
Copyright © 2021, ABES Engineering College
Specialization and Generalization

Specialization An entity type may include subgroupings of distinct entities in


some way from other entities in the set.

Generalization The refinement from an initial entity type into successive levels
of entity subgroupings represents a top-down design process in which
distinctions are made explicit.

37
Copyright © 2021, ABES Engineering College
Specialization and Generalization

38
Copyright © 2021, ABES Engineering College
Attribute Inheritance

A crucial property of the higher and lower-level entities created by specialization


and generalization is attribute inheritance.

The attributes of the higher-level entity types are said to be inherited by the
lower-level entity types.

39
Copyright © 2021, ABES Engineering College
Constraints on generalization

There are certain constraints that database designers choose to put on a


particular generalization.

Condition-defined: In condition-defined constraints lower-level entity types,


membership is evaluated based on whether or not an entity satisfies an explicit
condition or predicate.

User-defined: User-defined lower-level entity types are not constrained by a


membership condition; rather, the database user assigns entities to a given
entity type.

40
Copyright © 2021, ABES Engineering College
Constraints on generalization

The second type of constraint relates to whether or not entities may belong to
more than one lower-level entity type within a single generalization

Disjoint: A disjointness constraint requires that an entity belongs to no more


than one lower-level entity type. In our example, an EMPLOYEE entity can
satisfy only one condition; an entity can be either a faculty or a staff, but cannot
be both.

Overlapping: In overlapping generalizations, the same entity may belong to


more than one lower-level entity type within a single generalization.

41
Copyright © 2021, ABES Engineering College
Aggregation

Aggregation is an abstraction through which relationships with its corresponding


entities are aggregated into a higher-level entity.

42
Copyright © 2021, ABES Engineering College
Can we answer?

 Which of the following is the specialization that permits multiple sets?


a. Superclass specialization
b. Disjoint specialization
c. Overlapping specialization
d. None

43
Copyright © 2021, ABES Engineering College
Can we answer?

 The similarities between the entity set can be expressed by which of the
following features?
a. Specialization
b. Generalization
c. Uniquation
d. Inheritance

44
Copyright © 2021, ABES Engineering College
Question

 ………………………..is an abstraction through which relationships are


treated as higher level entities.
a. Creation
b. Superseding
c. Attribute separation
d. Aggregation

45
Copyright © 2021, ABES Engineering College
Question

 Consider representation of specialization and generalization, the blank


triangle is used to indicate the specific constraint called:
a. Disjoint node
b. Shared base constraint
c. Schema construct
d. Disjoint constraint

46
Copyright © 2021, ABES Engineering College
Thank You

47
Copyright © 2021, ABES Engineering College

You might also like