DATABASE DESIGN AND ENGINEERING
Database Design And Engineering-
typically focuses on the creation and
management of databases for a specific
company or organization.
The conceptual design has four steps:
1. Data analysis and requirements Types of Attributes
2. Entity relationship modeling and Simple attribute − Simple attributes are
normalization atomic values, which cannot be divided
3. Data model verification further. For example, a student's phone
4. Distributed database design number is an atomic value of 10 digits.
Composite attribute − Composite
Data Model attributes are made of more than one simple
An abstract model that organizes data attribute.
description, data semantics, and consistency Single-value attribute − Single-value
constraints of data. attributes contain single value
Emphasizes on what data is needed and Multi-value attribute − Multi-value
how it should be organized instead of what attributes may contain more than one values.
operations will be performed on data. Derived attribute − Derived attributes are
the attributes that do not exist in the physical
The two types of Data Modeling database, but their values are derived from
Techniques are: other attributes present in the database.
o Entity Relationship (E-R) Model
o UML (Unified Modelling Language) The attribute containing the primary key has
an underline underneath its name.
Entity Relationship Modelling
Entity-Relationship (ER) Model is based Multivalued attributes are depicted by
on the notion of real-world entities and double ellipse
relationships among them. Derived attributes are depicted by dashed
ER Model creates entity set, relationship ellipse.
set, general attributes and constraints.
ER Model is best used for the conceptual Relationship − logical association among
design of a database entities are mapped with entities in various
ways.
-Mapping cardinalities define the number
of associations between two entities.
-Relationships are represented by diamond-
shaped box and the name of the relationship
is written inside the diamond-box.
-All the entities (rectangles) participating in a
relationship, are connected to it by a line.
Entity − An entity in an ER Model is a real-
world entity having properties called
attributes.
Every attribute is defined by its set of
values called domain.
DATABASE DESIGN AND ENGINEERING
Mapping cardinalities
one to one - One entity from entity set A
can be associated with at most one entity of
entity set B and vice versa.
one to many - One entity from entity set A
can be associated with more than one ER Model – StarSchema
entities of entity set B however an entity Another form of the ER diagram is the star
schema,in which a central fact table
connects to multiple dimensional tables.
many to one - More than one entities from
entity set A can be associated with at most
one entity of entity set B, however an entity
from entity set B can be associated with more
than one entity from entity set A.
many to many - One entity from A can be
associated with more than one entity from B
and vice versa.
The data models are used to represent the
data and how it is stored in the database and
to set the relationship between data items.
Types of Data Models
Binary Relationship and Mapping
1. Conceptual Data Model: This Data Model
Cardinality
defines WHAT the system contains. This
Binary Relationship is a relationship
model is typically created by Business
where two entities are participating
stakeholders and Data Architects. The
Cardinality is the number of instances of
purpose is to organize, scope and define
an entity from a relation that can be business concepts and rules.
associated with the relation.
2. Logical Data Model: Defines HOW the
Cardinality defines the number of entities
system should be implemented regardless of
in one entity set, which can be associated
the DBMS. This model is typically created by
with the number of entities of other set via Data Architects and Business Analysts. The
relationship set.
purpose is to developed technical map of
rules and data structures.
Crow's Foot Notation
3. Physical Data Model: This Data Model
Crow's Foot diagrams represent entities as describes HOW the system will be
boxes, and relationships as lines between
implemented using a specific DBMS system.
the boxes.
This model is typically created by DBA and
Different shapes at the ends of these lines
developers. The purpose is actual
represent the cardinality of the relationship. implementation of the database.
DATABASE DESIGN AND ENGINEERING
Conceptual Model Database Normalization
is an organized view of database concepts Normalization is the process of
and their relationships. organizing data in a database.
The purpose of creating a conceptual data This includes creating tables and
model is to establish entities, their attributes, establishing relationships between those
and relationships. In this data modeling level, tables according to rules designed both to
there is hardly any detail available on the protect the data and to make the database
actual database structure. more flexible by eliminating redundancy and
The 3 basic tenants of Conceptual Data inconsistent dependency.
Model are: • It is the standard database process of
Entity removing redundant columns from table and
Attribute putting them in secondary tables that are
Relationship linked to the primary table by primary key and
foreign key relationships.`
Logical Data Model
is used to define the structure of data EDGAR CODD
elements and to set relationships between -inventor of relational model
them.
adds further information to the conceptual What are Anomalies?
data model elements. Insertion anomaly: There are
The advantage of using a Logical data circumstances in which certain facts cannot
model is to provide a foundation to form the be recorded at all.
base for the Physical model. Update anomaly: The same information
can be expressed on multiple rows; therefore
Physical Data Model updates to the relation may result in logical
describes a database-specific inconsistencies.
implementation of the data model. Deletion anomaly: the unintended loss of
It offers database abstraction and helps data due to deletion of other data.
generate the schema. This is because of the
richness of meta-data offered by a Physical
Data Model.
also helps in visualizing database structure
by replicating database column keys,
constraints, indexes, triggers, and other
RDBMS features.
DATABASE DESIGN AND ENGINEERING
Various Levels of Normalization Transitive Dependency
First Normal Form (1NF) Partial dependency
Second Normal Form (2NF) ➢ Non-key attribute is determined by a
Third Normal Form (3NF) primary key
Boyce-Codd Normal Form (BCNF) Transitive dependency
Fourth Normal Form (4NF) ➢ Non-key attribute is determined by
Fifth Normal Form (5NF) another non-key attribute
Most databases should be 3NF or BCNF in
order to avoid the database anomalies. Second Normal Form (2NF)
A table is in 1NF
First Normal Form There is no partial dependency
We say a relation is in 1NF if all values
stored in the relation are single valued and
atomic.
1NF places restrictions on the structure of
relations. Values must be simple.
Third Normal Form (3NF)
Candidate Key - is a column, or set of A table is in 2NF
columns, in a table that can uniquely identify There is no transitive dependency
any database record without referring to
any other data.
Prime Attribute − An attribute, which is a
part of the candidate-key, is known as a
prime attribute.
Non-prime attribute − An attribute, which is
not a part of the primary key, is said to be a
non-prime attribute.
Functional dependency is a relationship
that exists when one attribute uniquely
determines another attribute. represented by
an arrow sign (→) that is, X→Y, where X
functionally determines Y. The left-hand side
attributes
Multivalued attributes / repeating groups
Non-key attributes are not uniquely
identified by Primary key