Business-Database Management System
Business-Database Management System
Entity-Relationship Model
Entity-Relationship (ER) Model is based on the notion of
real-world entities and relationships among them.
The ER Model creates entity set, relationship set, general
attributes and constraints.
ER Model is based on
Entitiesand theirattributes.
Relationshipsamong entities.
Entity An entity in an ER Model is a real-world entity having
properties calledattributes. Everyattributeis defined by its set
of values calleddomain. For example, in a school database, a
student is considered as an entity. Student has various attributes
like name, age, class, etc.
Relationship The logical association among entities is
calledrelationship. Relationships are mapped with entities in
various ways. Mapping cardinalities define the number of
association between two entities.
Mapping cardinalities
one to one
one to many
many to one
many to many
Relational Model
1. The most popular data model in DBMS is the Relational Model.
2. The main highlights of this model are
Data is stored in tables calledrelations.
Relations can be normalized.
In normalized relations, values saved are atomic values.
Each row in a relation contains a unique value.
Each column in a relation contains values from a same
domain.
Database Schema
1. A database schema is the skeleton structure that represents
the logical view of the entire database.
2. It defines how the data is organized and how the relations
among them are associated.
A database schema can be divided broadly into two categories
Physical Database Schema This schema pertains to the actual
storage of data and its form of storage like files, indices, etc.
Logical Database Schema It defines tables, views, and
integrity constraints.
Database Instance
A database instance is a state of operational database with
data at any given time.
It contains a snapshot of the database.
Database instances tend to change with time.
ER MODELING
The ER model defines the conceptual view of a database. It works
around real-world entities and the associations among them.
Entity
An entity can be a real-world object, either animate or inanimate, that
can be easily identifiable.
For example, in a school database, students, teachers, classes, and
courses offered can be considered as entities.
An entity set is a collection of similar types of entities.
Attributes
Entities are represented by means of their properties, calledattributes.
All attributes have values. For example, a student entity may have name,
class, and age as attributes.
There exists a domain or range of values that can be assigned to
attributes.
Types of Attributes
Simple attribute Simple attributes are atomic values, which cannot be
divided further. For example, a student's phone number is an atomic value
of 10 digits.
Composite attribute Composite attributes are made of more than one
simple attribute. For example, a student's complete name may have
first_name and last_name.
Derived attribute Derived attributes are the attributes that do not exist
in the physical database, but their values are derived from other
attributes present in the database. For example, average_salary in a
department should not be saved directly in the database, instead it can
be derived. For another example, age can be derived from data_of_birth.
Single-value attribute Single-value attributes contain single value. For
example Social_Security_Number.
Multi-value attribute Multi-value attributes may contain more than one
values. For example, a person can have more than one phone number,
email_address, etc.
Entity-Set and Keys
Key is an attribute or collection of attributes that uniquely identifies an
entity among entity set.
Candidate Key A minimal super key is called a candidate key. An entity
set may have more than one candidate key.
Primary Key A primary key is one of the candidate keys chosen by the
database designer to uniquely identify the entity set.
Relationship
The association among entities is called a relationship. For example, an
employeeworks_ata department, a studentenrollsin a course. Here,
Works_at and Enrolls are called relationships.
Mapping Cardinalities
Cardinalitydefines the number of entities in one entity set, which can be
associated with the number of entities of other set via relationship set.
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 entities of entity set B however an entity from entity set B, can
be associated with at most one entity.
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.
Entities are represented by means of rectangles. Rectangles are named with
the entity set they represent.
One to many
Many to one
Many to many
Participation Constraints
Total Participation Each entity is involved in the relationship. Total
participation is represented by double lines.
Partial participation Not all entities are involved in the relationship.
Partial participation is represented by single lines.
The ER Model has the power of expressing database entities in a conceptual
hierarchical manner.
Generalization
The process of generalizing entities, where the generalized entities
contain the properties of all the generalized entities, is called
generalization.
Specialization
Specialization is the opposite of generalization. In specialization, a group
of entities is divided into sub-groups based on their characteristics.