Unit 1
Unit 1
In the late 1960’s, IBM developed the Integrated Management Systems which
is the standard database system used till date in many places.
It was developed based on the hierarchical database model. It was during the
year 1970 that the relational database model was developed by Edgar Codd.
*****************************************************************
Main characteristics of the database approach and how it differs from
traditional file system:
In a traditional file processing system, each user defines and implements its own
modifications to the files needed for a selected software application as a part of
programming the appliance. In the database approach, one repository maintains
data which is defined once then accessed by various users in that database.
DBMS gives an abstract view of File system provides the detail of the data
data that hides the details. representation and storage of data.
DBMS provides a crash recovery File system doesn't have a crash mechanism, i.e.,
mechanism, i.e., DBMS protects the if the system crashes while entering some data,
user from the system failure. then the content of the file will lost.
DBMS provides a good protection It is very difficult to protect a file under the file
mechanism. system.
DBMS contains a wide variety of File system can't efficiently store and retrieve the
sophisticated techniques to store data.
and retrieve the data.
DBMS takes care of Concurrent In the File system, concurrent access has many
access of data using some form of problems like redirecting the file while other
locking. deleting some information or updating some
information.
****************************************************************
The DataModel: Data Model is the modeling of the data description, data
semantics, and consistency constraints of the data. It provides the conceptual tools
for describing the design of a database at each level of data abstraction.
Therefore, there are following four data models used for understanding the
structure of the database:
1) Relational Data Model: This type of model designs the data in the form of
rows and columns within a table. Thus, a relational model uses tables for
representing data and in-between relationships. Tables are also called relations.
This model was initially described by Edgar F. Codd, in 1969. The relational data
model is the widely used model which is primarily used by commercial data
processing applications.
4) Semi structured Data Model: This type of data model is different from the
other three data models. The semi structured data model allows the data
specifications at places where the individual data items of the same type may have
different attributes sets. The Extensible Markup Language, also known as XML, is
widely used for representing the semi structured data. Although XML was initially
designed for including the markup information to the text document, it gains
importance because of its application in the exchange of data.
******************************************************************
Internal Scheme: The internal schema defines the physical storage structure of the
database. The internal schema is a very low-level representation of the entire
database. It contains multiple occurrences of multiple types of internal record.
Conceptual Schema/Level
The conceptual schema describes the Database structure of the whole database for
the community of users. This schema hides information about the physical
storage structures and focuses on describing data types, entities, relationships,
etc.
This logical level comes between the user level and physical storage view.
However, there is only single conceptual view of a single database.
External Schema/Level
An external schema describes the part of the database which specific user is
interested in. It hides the unrelated details of the database from the user. There
may be “n” number of external views for each database.
An external view is just the content of the database as it is seen by some specific
particular user. For example, a user from the sales department will see only
sales related data.
An external level is only related to the data which is viewed by specific end
users.
This level includes some external schemas.
External schema level is nearest to the user
Data Independence: Data independence can be explained using the three-schema
architecture.
Requirement Analysis
Planning - This stage is concerned with planning the entire DDLC (Database
Development Life Cycle). The strategic considerations are taken into account
before proceeding.
System definition - This stage covers the boundaries and scopes of the proper
database after planning.
Database Designing
Physical Model - The physical model is concerned with the practices and
implementations of the logical model.
Logical Model - This stage is primarily concerned with developing a model based
on the proposed requirements. The entire model is designed on paper without any
implementation or adopting DBMS considerations.
Implementation
Data conversion and loading - This section is used to import and convert data
from the old to the new system.
Component of ER Diagram
Notation of ER diagram
Entity:
Attributes:
Entities are represented by means of their properties, called attributes. 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. For
example, a student's name cannot be a numeric value. It has to be alphabetic. A
student's age cannot be negative, etc.
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.
These attribute types can come together in a way like −
******************************************************************
************
Entity-Set and Keys
Key is an attribute or collection of attributes that uniquely identifies an entity
among entity set.
For example, the roll_number of a student makes him/her identifiable among
students.
Super Key − A set of attributes (one or more) that collectively identifies an
entity in an 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 Set
A set of relationships of similar type is called a relationship set. Like entities, a
relationship too can have attributes. These attributes are called descriptive
attributes.
Degree of Relationship
The number of participating entities in a relationship defines the degree of the
relationship.
Binary = degree 2
Ternary = degree 3
n-ary = degree
Mapping Cardinalities
Cardinality defines 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.
Draw an ER Diagram for BANK database schema with atleast five entity
types. Also specify Primary Key and Structural Constraints .
Bank Entity : Attributes of Bank Entity are Bank Name, Code and Address.
Code is Primary Key for Bank Entity.
Customer Entity : Attributes of Customer Entity are Customer_id, Name, Phone
Number and Address.
Customer_id is Primary Key for Customer Entity.
Branch Entity : Attributes of Branch Entity are Branch_id, Name and Address.
Branch_id is Primary Key for Branch Entity.
Account Entity : Attributes of Account Entity are Account_number,
Account_Type and Balance.
Account_number is Primary Key for Account Entity.
Loan Entity : Attributes of Loan Entity are Loan_id, Loan_Type and Amount.
Loan_id is Primary Key for Loan Entity.
Relationships are :
Conceptual DesignwiththeERModel: