Unit-2-DAY 6_24_09
Unit-2-DAY 6_24_09
Keys
Unit2 _Day 6
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
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.)
7
Copyright © 2021, ABES Engineering College
Cardinality Ratio (Cont.)
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.
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.
10
Copyright © 2021, ABES Engineering College
Can we answer?
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.
13
Copyright © 2021, ABES Engineering College
Can we answer?
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
16
Copyright © 2021, ABES Engineering College
Total and Partial Participation
17
Copyright © 2021, ABES Engineering College
Identifying relationship 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.
19
Copyright © 2021, ABES Engineering College
Question
20
Copyright © 2021, ABES Engineering College
Question
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
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
Topics to be covered
• Keys
• Primary
• Foreign key
• Extended ER diagram
Ver. No.: 1.1 Copyright © 2021, ABES Engineering College
Keys
Primary Key
Composite Primary Key
Foreign Key
26
Copyright © 2021, ABES Engineering College
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.
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
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
Is needed to design accurate database schemas that reflect data properties and
constraints more precisely.
Applications: CAD/CAM, Telecommunications, GIS etc…
36
Copyright © 2021, ABES Engineering College
Specialization and Generalization
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
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
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
41
Copyright © 2021, ABES Engineering College
Aggregation
42
Copyright © 2021, ABES Engineering College
Can we answer?
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
45
Copyright © 2021, ABES Engineering College
Question
46
Copyright © 2021, ABES Engineering College
Thank You
47
Copyright © 2021, ABES Engineering College