Lecture 3
Lecture 3
Second stage
Alshaab University
Mohammed
Database Design
When designing a database, you are modeling a real business system that
contains a set of entities and their characteristics, or attributes, and the rules or
is to understand what data is to be stored in the database, we must find out what
the users want from the database. Several methodologies have been proposed for
organizing and presenting the information gathered in this step, and some
2. Conceptual Database Design: This step is often carried out using the ER
3. Logical Database Design: The task in the logical design step is to convert an
typical expected workloads that our database must support and further refine
diagram are Entity, Attribute, and Relationship. See Figure 1.1 below
Rectangles divided into two parts represent entity sets. The first part, which in
this text book is shaded blue,contains the name of the entity set.The second part
sets.
Data Modeling Using the Entity-Relationship Model
model is used in a phase called conceptual database design. The main motivation
for defining the ER model is to provide a high level model for conceptual
which means that the database designer do not have to worry about the physical
The ER modeling can be carried out with the help of pictorial representation of
lectures:
be tangible object (e.g., person, place) or non tangible (e.g., event, customer
account).
Attribute Classification
Single value attribute Single value attribute means, there is only one value
associated with that attribute. One example of single value attribute is age of a
person.
Multi value attribute In the case of Multi value attribute; more than one value
derived from the date of birth of the person. In this example, age is the derived
attribute.
Null Value Attribute In some cases, a particular entity may not have any
applicable value for an attribute. For such situation, a special value called null
no. if a person do not have phone then a null value is entered in that column.
which can be further subdivided into Street name, City, and State.
Entity Types and Entity Sets:
A database usually contains groups of entities that are similar. For example, a
information concerning each of the employees. These employee entities share the
same attributes, but each entity has its own value(s) for each attribute. An entity
type defines a collection (or set) of entities that have the same attributes. Each
entity type in the database is described by its name and attributes. Figure 1.2
shows two entity types: EMPLOYEE and COMPANY, and a list of some of the
attributes for each. A few individual entities of each type are also illustrated,
along with the values of their attributes. The collection of all entities of a
particular entity type in the database at any point in time is called an entity set;
the entity set is usually referred to using the same name as the entity type. For
example, EMPLOYEE refers to both a type of entity as well as the current set of
Constraint
E-R enterprise schema may define certain constraints to which the contents of a
participation constraints.
Mapping Cardinalities
entity can be associated via a relationship set. Mapping cardinalities are most
useful in describing binary relationship sets, although they can contribute to the
description of relationship sets that involve more than two entity sets. In this
entities in B.An entity in B.however, can be associated with at most one entity in
A.
entities in A.
partial. In Figure1.4, the participation of both A and B in the relationship set are
total. For example, we expect every student entity to be related to at least one
student in the relationship set a dvisor is total. In contrast, an instructor need not
advise any students. Hence, it is possible that only some of the instructor entities
are related to the student entity set through the a dvisor relationship, and the
Keys
We must have a way to specify how entities within a given entity set are
their attributes. Therefore, the values of the attribute values of an entity must be
such that they can uniquely identify the entity. In other words, no two entities in
an entity set are allowed to have exactly the same value for all attributes. The
notion of a key for a relation schema.applies directly to entity sets. That is, a key
for an entity is a set of attributes that suffice to distinguish entities from each
other.The concepts of super key, candidate key, and primary key are applicable
entities of the set. We need a similar mechanism to distinguish among the various
It is a unique key.
It cannot be NULL.
Primary keys are not necessarily to be a single column; more than one
Super Key
The set of attributes that can uniquely identify a tuple is known as Super Key.A
super key is a group of single or multiple keys that identifies rows in a table. It
Adding zero or more attributes to the candidate key generates the super key.
Candidate Key
The minimal set of attributes that can uniquely identify a tuple is known as a
candidate key.
A table can have multiple candidate keys but only one primary key.
Strong entity: is one whose existence does not depend on other entity.
there are no students to take a particular course, then that course cannot be
Weak Entity: Weak entity is one whose existence depends on other entity. In
many cases, weak entity does not have primary key. Example: Consider the
example, customer borrows loan. Here loan is a weak entity. For every loan,
there should be at least one customer. Here the entity loan depends on the