Unit2
Unit2
Diagram
Slide 3-1
Using high level conceptual
data models for database design
Slide 3-2
A simplified overview of the database
design process
• Database design process is divided into 4 Steps:
1.requirements collection and analysis
2.Conceptual Design
3.Logical Design
4.Physical Design
Slide 3-3
A simplified
diagram to
illustrate the
main phases of
database
design.
Slide 3-4
1. requirements collection and analysis
•During this step, the database designers interview prospective
database users to understand and document their data requirements.
•The result of this step is a concisely written set of users’
requirements.
• These requirements should be specified in as detailed and complete
a form as possible.
•In parallel with specifying the data requirements, it is useful to
specify the known functional requirements of the application.
Slide 3-5
2. Conceptual design
•In parallel with specifying the data requirements, it is useful to specify
step is called conceptual design.
Slide 3-6
• The high-level conceptual schema can also be used as a
reference to ensure that all users’ data requirements are
met and that the requirements do not conflict.
• This approach enables database designers to concentrate on
specifying the properties of the data, without being
concerned with storage and implementation details, which
makes it is easier to create a good conceptual database design.
• During or after the conceptual schema design, the basic data
model operations can be used to specify the high-level user
queries and operations identified during functional analysis.
• This also serves to confirm that the conceptual schema meets
all the identified functional requirements.
• Modifications to the conceptual schema can be introduced if
some functional requirements cannot be specified using the
initial schema.
• Example of conceptual schema is Entity Relationship Diagram
Slide 3-7
3. Logical Design
The next step in database design is the actual implementation of
the database, using a commercial DBMS.
• Most current commercial DBMSs use an implementation data
model—such as the relational (SQL) model—so the conceptual
schema is transformed from the high-level data model into the
implementation data model.
• This step is called logical design or data model mapping;
• its result is a database schema in the implementation data
model of the DBMS.
Slide 3-8
4. Physical design
•The last step is the physical design phase,
• during which the internal storage structures, file
organizations, indexes, access paths, and physical design
parameters for the database files are specified.
•In parallel with these activities, application programs are
designed and implemented as database transactions
corresponding to the high-level transaction specifications
Slide 3-9
Entities and Attributes
• The basic concept that the ER model represents is an entity,
which is a thing or object in the real world with an independent
existence.
• An entity may be an object with a physical existence (for
example, a particular per son, car, house, or employee) or it
may be an object with a conceptual existence (for instance, a
company, a job, or a university course).
• Each entity has attributes—the particular properties that
describe it. For example, an EMPLOYEE entity may be
described by the employee’s name, age, address, salary, and
job.
Slide 3-10
Example
Slide 3-11
Types of Attributes
• Composite attributes can be divided into smaller subparts, which
represent more basic attributes with indepen dent meanings. For
example, the Address attribute of the EMPLOYEE entity shown in
can be subdivided into Street_address, City, State, and Zip.
• In some cases an attribute can have a set of values for the same
entity is called multivalued. For instance, a Colors attribute for a
car, or a College_degrees attribute for a person.
Slide 3-12
• In some cases, two (or more) attribute values are related—for
example, the Age and Birth_date attributes of a person. For a
particular person entity, the value of Age can be determined from
the current (today’s) date and the value of that person’s Birth_date.
The Age attribute is hence called a derived attribute and is said to
be derivable from the Birth_date attribute, which is called a stored
attribute.
Slide 3-13
• We can represent arbitrary nesting by grouping can be specified as
components of a composite attribute between parentheses ( ) and
separating the components with commas, and by displaying
multivalued attributes between braces { }. Such attributes are
called complex attributes. For example, if a person can have
more than one residence and each residence can have a single
address and multiple phones, an attribute Address_phone for a
person
Slide 3-14
Entity Type
Slide 3-15
Slide 3-16
Entity Set
The collection of all entities of a particular entity type in
the data-base at any point in time is called an entity set.
It is called extension of entity type.
Slide 3-17
Key
• An important constraint on the entities of an entity
type is the key or uniqueness constraint on
attributes.
• An entity type usually has one or more attributes
whose values are distinct for each individual entity
in the entity set.
• Such an attribute is called a key attribute, and its
values can be used to identify each entity uniquely.
Slide 3-18
Value Set
Each simple attribute of an entity type is associated with
a value set (or domain of values), which specifies the
set of values that may be assigned to that attribute for
each individual entity.
Slide 3-19
Initial Conceptual Design of the COMPANY Database
Slide 3-20
Slide 3-21
Relationship Types, Relationship Sets,
Roles, and Structural Constraints
Slide 3-22
Relationship Types, Sets, and Instances
1. Relationship Type
Slide 3-23
Professor Teaches Courses
Slide 3-24
2. Relationship Set
3. Relationship Instance
Slide 3-25
Professor Teaches Courses
P2 r2 c2
P3 r3 c3
p4 r4 c4
Slide 3-27
Supplier Supply Customer
Vendor
Slide 3-28
5. Role Names in Relationships
Role names are used when entities in a relationship participate in
different capacities. This is especially useful when an entity type plays
more than one role in a relationship. Role names help distinguish these
roles.
Example :
HOD-Faculty relationship
HOD & Faculty both are instances of entity type “Staff”
Relationship type reporting have two roles : HOD & Faculty
Example in Database :
Slide 3-30
Staff Report Staff
S2 r1
S3 r2
S1
S4 r3
S5 r4
Slide 3-31
Constraints on Binary Relationship Types
1. Cardinality Constraints
Cardinality constraints define the number of entities that can
participate in a relationship. The common types of cardinality
constraints are:
Slide 3-33
Slide 3-34
2. Participation Constraints
Participation constraints specify whether all instances of an entity
must participate in the relationship (total participation) or if some
instances can exist without being related (partial participation).
Event
Students
S1
S2 E1
S3 E2
S4
s5
Slide 3-35
3. Key Constraints (Identifying Dependencies)
Student Exam
S1 E1
S2 E2
S3 E3
S4 E4
S5 E5
One-to-one
Slide 3-36
Customer Loan
Cust_id Loan_id
Cust_name Kyc
Mob_no Cust_id
Pan_no
Many-to-one
Slide 3-37
Customer Account
Cust_id Acc_id
Cust_name No.of Account
Mob_no Acc_Details
Pan_no Tax details
One-to-Many
Slide 3-38
4. Referential Integrity Constraints
Referential integrity constraints ensure that
relationships between entities remain valid. This is
particularly important when foreign keys are involved.
Slide 3-39
5. Existence Dependency Constraints
Existence dependency constraints specify whether one entity's
existence depends on the existence of another.
Slide 3-40
Weak Entity Types vs. Strong Entity
Types
Weak Entity
•Entity types that do not have key attributes of their own
are called weak entity types.
•It refers to an entity that cannot be uniquely identified by
its own attributes alone.
•Instead, a weak entity depends on a "strong" (or
"regular") entity to provide a unique identifier, typically
through a relationship.
Slide 3-41
Key features of a weak entity:
•Dependent on a strong entity: A weak entity does not
have a primary key or enough attributes to uniquely
identify its instances. It needs a foreign key, typically a
reference to a strong entity, to form a composite key.
Slide 3-43
Key characteristics of a strong entity:
Slide 3-44
Example
Consider a database for a library system:
•Strong entity: "Book" with an ISBN as its primary
key.
•Weak entity: "Chapter," which cannot be uniquely
identified without knowing the book it belongs to. The
chapter number (partial key) alone is not enough; the
combination of the book's ISBN and the chapter
number is required to uniquely identify a chapter.
Slide 3-45
Table (Entity) : BOOK
Slide 3-46
Refining the ER Design for the COMPANY
Database
Entity types :
1.Employee
2.Department
3.Project
Slide 3-48
Notation for ER Diagrams
Slide 3-49
Slide 3-50
Example of Other Notation: UML Class Diagrams
(OMT-Object Modeling Technique)
Slide 3-51
Relationship types of Degree
Slide 3-53
Superclass and Subclass
Slide 3-54
Generalization and Specialization
Slide 3-55
Slide 3-56