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

UNIT 2 RECENT EDIT

The document outlines the syllabus for a unit on Database Design, focusing on the Entity-Relationship (ER) model and its components, including E-R diagrams, relationships, and attributes. It details the six phases of database design, from requirement analysis to application and security design, and explains concepts such as mapping cardinality and weak vs. strong entity sets. Additionally, it introduces the Enhanced ER model, discussing specialization and generalization within entity hierarchies.

Uploaded by

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

UNIT 2 RECENT EDIT

The document outlines the syllabus for a unit on Database Design, focusing on the Entity-Relationship (ER) model and its components, including E-R diagrams, relationships, and attributes. It details the six phases of database design, from requirement analysis to application and security design, and explains concepts such as mapping cardinality and weak vs. strong entity sets. Additionally, it introduces the Enhanced ER model, discussing specialization and generalization within entity hierarchies.

Uploaded by

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

Unit: II: Database Design

Syllabus

Entity-Relationship model - E-R Diagrams - Enhanced-ER Model - ER-to-Relational Mapping


- Functional Dependencies Non-loss Decomposition - First, Second, Third Normal Forms,
Dependency Preservation - Boyce/Codd Normal Form Multi-valued Dependencies and
Fourth Normal Form - Join Dependencies and Fifth Normal Form.

Part I: Entity Relationship Model

2.1 Introduction to Entity Relationship Model

Entity Relational model is a model for identifying entities to be represented in the


database and representation of how those entities are related.

Let us irst understand the design process of database design.

2.1.1 Design Phases

Following are the six steps of database design process. The ER model is most relevant to
irst three steps

Step 1: Requirement analysis:

• In this step, it is necessary to understand what data need to be stored in the database,
what applications must be built, what are all those operations that are frequently used by
the system.

• The requirement analysis is an informal process and it requires proper communication


with user groups.

• There are several methods for organizing and presenting information gathered inthis
step.

• Some automated tools can also be used for this purpose.

Step 2: Conceptual database design:

• This is a steps in which E-R Model i.e. Entity Relationship model is built.

• E-R model is a high level data model used in database design.

• The goal of this design is to create a simple description of data that matches with the
requirements of users.

Step 3: Logical database design:

• This is a step in which ER model in converted to relational database schema, sometimes


called as the logical schema in the relational data model.
Step 4: Schema re inement:

• In this step, relational database schema is analyzed to identify the potential smise
problems and to re ine it.

• The schema re inement can be done with the help of normalizing and restructuring the
relations.

Step 5: Physical database design:

• In this step, the design of database is re ined further.

• The tasks that are performed in this step are building indexes on tables and clustering
tables, redesigning some parts of schema obtained from earlier design steps.

Step 6: Application and security design:

• Using design methodologies like UML (Uni ied Modeling Language) the design of the
database can be accomplished.

• The role of each entity in every process must be re lected in the application task.

• For each role, there must be the provision for accessing the some part of database and
prohibition of access to some other part of database.

• Thus some access rules must be enforced on the application(which is accessing the
database) to protect the security features.

2.1.2 ER Model

The ER data model speci ies enterprise schema that represents the overall logical
structure of a database.

The E-R model is very useful in mapping the meanings and interactions of real-world
entities onto a conceptual schema.

The ER model consists of three basic concepts –

1) Entity Sets

• Entity: An entity is an object that exists and is distinguishable from other objects. For
example - Student named "Poonam" is an entity and can be identi ied by her name. The
entity can be concrete or abstract. The concrete entity can be - Person, Book, Bank.The
abstract entity can be like - holiday, concept entity is represented as a box.

• Entity set: The entity set is a set of entities of the same types. For example - All students
studying in class X of the School. The entity set need not be disjoint. Each entity in entity
set have the same set of attributes and the set of attributes will distinguish it from other
entity sets. No other entity set will have exactly the same set of attributes.

2) Relationship Sets

Relationship is an association among two or more entities.


The relationship set is a collection of similar relationships. For example - Following Fig.
2.1.2 shows the relationship works for for the two entities Employee and Departments.

The association between entity sets is called as participation. That is, the entity sets E1,
E2,..., En participate in relationship set R.

The function that an entity plays in a relationship is called that entity's role.

3) Attributes

Attributes de ine the properties of a data object of entity. For example if student is an
entity, his ID, name, address, date of birth, class are its attributes. The attributes help in
determining the unique entity. Refer Fig. 2.1.3 for Student entity set with attributes - ID,
name, address. Note that entity is shown by rectangular box and attributes are shown in
oval. The primary key is underlined.

Types of Attributes

1) Simple and Composite Attributes:

1) Simple attributes are attributes that are drawn from the atomic value domains

For example - Name = {Parth}; Age = {23}

2) Composite attributes: Attributes that consist of a hierarchy of attributes For example -


Address may consists of "Number", "Street" and "Suburb"→ Address = {59+ 'JM Road' +
'Shivaji Nagar'}
2) Single valued and multivalued:

• There are some attributes that can be represented using a single value. For example

- StudentID attribute for a Student is speci ic only one studentID.

• Multivalued attributes: Attributes that have a set of values for each entity. It is
represented by concentric ovals

For example - Degrees of a person: BSc', 'MTech', 'PhD'

3) Derived attribute:

Derived attributes are the attributes that contain values that are calculated from other
attributes. To represent derived attribute there is dotted ellipse inside the solid ellipse.
For example Age can be derived from attribute DateOfBirth. In this situation, DateOfBirth
might be called Stored Attribute.

2.2 Mapping Cardinality

Mapping Cardinality represents the number of entities to which another entity can be
associated via a relationship set.

The mapping cardinalities are used in representing the binary relationship sets. Various
types of mapping cardinalities are –
1) One to One: An entity A is associated with at least one entity on B and an entity B is
associated with at one entity on A. This can be represented as,

2) One to Many: An entity in A is associated with any number of entities in B. An entity


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

3) Many to One: An entity in A is associated with at most one entity in B. An entity in B,


however, can be associated with any number of entities in A.
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.

2.3 ER Diagrams

An E-R diagram can express the overall logical structure of a database graphically. E-R
diagrams are used to model real-world objects like a person, a car, a company and the
relation between these real-world objects.

Features of ER model

i) E-R diagrams are used to represent E-R model in a database, which makes them easy to
be converted into relations (tables).

ii) E-R diagrams provide the purpose of real-world modelling of objects which makes
them intently useful.

iii) E-R diagrams require no technical knowledge and no hardware support.

iv) These diagrams are very easy to understand and easy to create even by a naive user.

v) It gives a standard solution of visualizing the data logically.

Various Components used in ER Model are-


2.3.1 Mapping Cardinality Representation using ER Diagram

There are four types of relationships that are considered for key constraints.

i) One to one relation: When entity A is associated with at the most one entity B then it
shares one to one relation. For example - There is one project manager who manages only
one project.

ii) One to many: When entity A is associated with more than one entities at a time then
there is one to many relation. For example - One customer places order at a time.

iii) Many to one: When more than one entities are associated with only one entity then
there is many to one relation. For example – Many students take a ComputerSciCourse

iv) Many to many: When more than one entities are associated with more than one
entities. For example -Many teachers can teach many students.

2.3.2 Ternary Relationship

The relationship in which three entities are involved is called ternary relationship. For
example –
2.3.3 Binary and Ternary Relationships

• Although binary relationships seem natural to most of us, in reality it is sometimes


necessary to connect three or more entities. If a relationship connects three entities, it is
called ternary or "3-ary."

• Ternary relationships are required when binary relationships are not suf icient to
accurately describe the semantics of an association among three entities.

• For example - Suppose, you have a database for a company that contains the entities,
PRODUCT, SUPPLIER, and CUSTOMER. The usual relationships might be PRODUCT/
SUPPLIER where the company buys products from a supplier - a normal binary
relationship. The intersection attribute for PRODUCT/SUPPLIER is wholesale_price

Now consider the CUSTOMER entity, and that the customer buys products. If all customers
pay the same price for a product, regardless of supplier, then you have a simple binary
relationship between CUSTOMER and PRODUCT. For the CUSTOMER/PRODUCT
relationship, the intersection attribute is retail_price.
• Single ternary relation: Now consider a different scenario. Suppose the customer buys
products but the price depends not only on the product, but also on the supplier. Suppose
you needed a customerID, a productID, and a supplierID to identify a price. Now you have
an attribute that depends on three things and hence you have a relationship between
three entities (a ternary relationship) that will have the intersection attribute, price.

2.3.4 Weak Entity Set

• A weak entity is an entity that cannot be uniquely identi ied by its attributes alone. The
entity set which does not have suf icient attributes to form a primary key is called as weak
entity set.

• Strong Entity Set

The entity set that has primary key is called as strong entity set

Weak entity set because each player needs a team


Weak entity rules

• A weak entity set has one or more many-one relationships to other (supporting) entity
sets.

• The key for a weak entity set is its own underlined attributes and the keys for the
supporting entity sets. For example - player-number and team-name is a key for Players.

Difference between Strong and Weak Entity Set

2.4 Enhanced ER Model

Specialization and Generalization AU: Dec- 19, Marks 7

• Some entities have relationships that form hierarchies. For instance, Employee can be
an hourly employee or contracted employee.

• In this relationship hierarchies, some entities can act as superclass and some other
entities can act as subclass.

• Superclass: An entity type that represents a general concept at a high level, is called
superclass.

• Subclass: An entity type that represents a speci ic concept at lower levels, is called
subclass.

• The subclass is said to inherit from superclass. When a subclass inherits from one or
more superclasses, it inherits all their attributes. In addition to the inherited attributes, a
subclass can also de ine its own speci ic attributes.

• The process of making subclasses from a general concept is called specialization. This is
top-down process. In this process, the sub-groups are identi ied within an entity set
which have attributes that are not shared by all entities.

You might also like