CH 2
CH 2
- I) Database Management
Systems
Database
Management System 2
2.1. Basic Concepts and Definitions in DBMS
2.2. DBMS
2.3. Views of Data
2.4. Data Model
2.5. Entity Relationship Diagram
2.6. Overall System Structure
Introduction :
A database is an organized collection of data. A database management
system (DBMS) is a collection of interrelated data and a set of programs to
access those data. This is a collection of related data with an implicit meaning
and hence is a database. A database view is a subset of the database sorted
and displayed in a particular way. A data model is a collection of high-level data
description constructs that hide many low-level storage details. A DBMS allows a
user to define the data to be stored in terms of a data model.
2.1
B.C.A. (Sem. - I) Database Management
Systems
2.2
B.C.A. (Sem. - I) Database Management
Systems
2.3
B.C.A. (Sem. - I) Database Management
Systems
A) Meaning:
Data dictionary is an integral part of database. The data dictionary (or data
repository) or system catalog is an important part of the DBMS. It contains
data about data (or metadata). It means that it contains the actual database
descriptions used by the DBMS. In most DBMS, the data dictionary is active
and integrated. It means that the DBMS checks the data dictionary every time
the database is accessed. A DBMS component is that stores metadata. It is
the self-describing nature of the database that provides program-data
independence. It is a tool for recording and processing information
(metadata) about the data that an organization uses.
2.4
B.C.A. (Sem. - I) Database Management
Systems
2.1.5 Record:
A record is a collection of all the facts related to one physical or
conceptual entity; often referring to a single object or person, usually represented
as a row of data in a table, and sometimes referred to as a tuple in some,
particularly older, database management systems. A record is composed of a
group of related fields. As another way of saying it, a record contains a collection
of attributes related to an entity such as a person or product. Looking at the list of
potential gun control supporters, the name, address, zip code and telephone
number of a single individual would constitute a record. A payroll record would
contain the name, address, social security number, and title of each employee.
2.5
B.C.A. (Sem. - I) Database Management
Systems
2.6
B.C.A. (Sem. - I) Database Management
Systems
2.7
B.C.A. (Sem. - I) Database Management
Systems
Databases are used for maintaining the patient health care details.
8) Digital Libraries and Digital Publishing:
Databases are used for management and delivery of large bodies of textual
and multimedia data.
9) Finance:
Databases are used for storing information such as sales, purchases of
stocks and bonds or data useful for online trading.
10) Sales:
Databases are used to store product, customer and transaction details.
11) Human Resources:
Organizations use databases for storing information about their employees,
salaries, benefits, taxes, and for generating salary checks.
Sr.N Points
DBMS File processing System
o
1 Meaning A Database File processing system is a
Management System system used to store and
(DBMS) is a set of manage data that involves
computer programs that each department or area
controls the creation, within an organization
maintenance, and the having its own set of files,
use of the database of often creating data
an organization and its redundancy and data
end users. isolation.
2 Data A database File-processing system is
Access management system is designed to allow
designed to allow predetermined access to
flexible access to data data (i.e., compiled
(i.e., queries). programs).
2.8
B.C.A. (Sem. - I) Database Management
Systems
2.9
B.C.A. (Sem. - I) Database Management
Systems
same rules and guidelines are apply across all types of data. The level of
consistency across files and programs also makes it easier to manage data,
when multiple programmers are involved.
5) User-Friendly:
Data is easier to access and manipulate with a DBMS than without it. In most
cases, DBMS also reduce the reliance of individual users on computer
specialists to meet their data needs.
6) Improved Security:
DBMS allow multiple users to access the same data resources. This
capability is generally viewed as a benefit, but there are potential risks for the
organization. Some sources of information should be protected or secured
and only viewed by selected individuals. Through the use of passwords,
database management systems can be used to restrict data access to only
those who should see it.
7) Data Atomicity:
A transaction in commercial databases is referred to as atomic unit of work.
For example, when someone purchases something from a point of sale
(POS) terminal, a number of tasks are performed such as;
i) Company stock is updated.
ii) Amount is added in company's account.
iii) Sales person's commission increases etc.
All these tasks collectively are called as atomic unit of work or transaction.
These tasks must be completed in all otherwise partially completed tasks are
rolled back. Thus, through DBMS, it is ensured that only consistent data
exists within the database.
8) Database Access Language:
Most of the DBMS provide SQL as standard database access language. It is
used to access data from multiple tables of a database.
9) Report Writers:
Most of the DBMS provide the report writer tools used to create reports. The
users can create reports very easily and quickly. Once a report is created, it
can be used many times and it can be modified very easily. The created
reports are also saved along with database and behave like a software
component.
2.10
B.C.A. (Sem. - I) Database Management
Systems
B) Disadvantages:
1) Security:
Even with safeguards in place, it may be possible for some unauthorized
users to access the database. In general, database access is an all or
nothing proposition. Once an unauthorized user gets into the database, they
have access to all the files, not just a few. Depending on the nature of the
data involved, these breaches in security can also pose a threat to individual
privacy. Steps should also be taken to regularly make backup copies of the
database files and store them because of the possibility of fires and
earthquakes that might destroy the system.
2) Cost of Hardware & Software:
A processor with high speed of data processing and memory of large size is
required to run the DBMS software. It means that user have to upgrade the
hardware used for file-based system. Similarly, DBMS software is also Very
costly.
3) Cost of Data Conversion:
When a computer file-based system is replaced with a database system, the
data stored into data file must be converted to database files. It is difficult and
time consuming method to convert data of data files into database. User have
to hire DBA (or database designer) and system designer along with
application programmers; alternatively, he have to take the services of some
software houses. So, a lot of money has to be paid for developing database
and related software.
4) Cost of Staff Training:
Most DBMS are often complex systems so the training for users to use the
DBMS is required. Training is required at all levels, including programming,
application development, and database administration. The organization has
to pay a lot of amount on the training of staff to run the DBMS.
5) Appointing Technical Staff:
The trained technical persons such as database administrator and application
programmers, etc. are required to handle the DBMS. Organization has to pay
handsome salaries to these persons. Therefore, the systems cost increases.
6) Database Failures:
2.11
B.C.A. (Sem. - I) Database Management
Systems
2.12
B.C.A. (Sem. - I) Database Management
Systems
2.13
B.C.A. (Sem. - I) Database Management
Systems
2) Indirect Users:
Indirect users are those users, who desire benefit from the work of DBMS
indirectly. They use the outputs generated by the programs, for decision
making or any other purpose. They are just concerned with the output and
are not bothered about the programming part.
2.14
B.C.A. (Sem. - I) Database Management
Systems
The next-higher level of abstraction describes what data are stored in the
database, and what relationships exist among those data. The logical level
describes the entire database in terms of a small number of relatively simple
structures. Although implementation of the simple structures at the logical
level may involve complex physical-level structures, the user of the logical
level does not need to be aware of this complexity. Database administrators,
who must decide what information to keep in the database, use the logical
level of abstraction.
3) View Level:
The highest level of abstraction describes only part of the entire database.
Even though the logical level uses simpler structures, complexity remains
because of the variety of information stored in a large database. Many users
of the database system do not need all this information; instead, they need to
access only a part of the database. The view level of abstraction exists to
simplify their interaction with the system. The system may provide many
views for the same database.
2.15
B.C.A. (Sem. - I) Database Management
Systems
Data
Model
2.16
B.C.A. (Sem. - I) Database Management
Systems
2.17
B.C.A. (Sem. - I) Database Management
Systems
description of what users want from their database to a more detailed and
precise, description that can be implemented in a DBMS.
Elements of Entity Relationship Model:
1) Entity:
An Entity is a person, place, object, event, or concept that an organization
wants to maintain data on. Each entity has a unique identity that differentiates
it from other entities. A point of distinction must be made between entity types
and entity instances.
2) Attribute:
An Attribute is a characteristic of an entity that is relevant to the organization.
When defining an attribute, an analyst should state why the attribute is
important, what is included in the attribute’s value, the source of the value,
and whether or not that value can change.
City
Surname
Name Person
Fig 2.8: Person entity have Name, surname, city, state
Stateare attributes
3) Relationship:
A relationship represents some association between two or more entities. In
an E-R diagram, a relationship is represented as a diamond shape,
containing the name of the relationship between the entities. Returning to our
final year project database relations from earlier,
STUDENT (ID, Surname, Forename, Programme, Date_of_Birth).
PROJECT (Proj-ID, Project-Title, Student-ID, Year).
It can represent the relationship between these relations as follows:
1 1 1
Student Assigned Projects
Fig : 2.9
In above diagram it can show the Connectivity of the relationship, which in
this case is a one-to-one (1:1) relationship. The one-to-one relationship
2.18
B.C.A. (Sem. - I) Database Management
Systems
shown reflects the fact that each student is assigned (at most) one project
and that each project is assigned to (at most) one student.
2.19
B.C.A. (Sem. - I) Database Management
Systems
2.20
B.C.A. (Sem. - I) Database Management
Systems
2.21
B.C.A. (Sem. - I) Database Management
Systems
2.22
B.C.A. (Sem. - I) Database Management
Systems
Attribute Attribute
Attribute
Attribute
Relationship Relationship
Entity
Attribute
Attribute
Attribute
Symbol of Entity:
An entity is an object or concept about use to store information. An entity is a
“thing” or “object” in the real world that is distinguishable from all other
2.23
B.C.A. (Sem. - I) Database Management
Systems
The entity set which does not have sufficient attributes to form a primary key
is called as Weak entity set. In a database, a Weak Entity is an entity that
cannot be uniquely identified by its attributes alone; therefore, it must use a
foreign key in conjunction with its attributes to create a primary key.
Consider an entity set Payment which has three attributes: payment_number,
payment_date and payment_amount. Although each payment entity is
distinct but payment for different loans may share the same payment number.
2.24
B.C.A. (Sem. - I) Database Management
Systems
Thus, this entity set does not have a primary key and it is an entity set. Each
weak set must be a part of one-to-many relationship set.
Example:
1 M
Building has Room
Subject_Name
RollNo Name
Surname
have
Student Subject
1 M
Address
SubjectNo
Fig 2.16 : Attribute
2.25
B.C.A. (Sem. - I) Database Management
Systems
In above diagram, one student have many subjects, in that case Name,
RollNo, Surname, Address are attributes of Students. Subject_Name,
SubjectNo are attributing of entity Subject.
4) Multivalued Attribute:
Symbol of Multivalued Attribute:
Attribute
A multivalued attribute can have more than one value. For example, an
employee entity can have multiple skill values. An instructor may have zero,
one, or several phone numbers, and different instructors may have different
numbers of phones. This type of attribute is said to be multivalued.
Example:
a) A customer can have multiple phone numbers, email id's etc
b) A person may have several college degrees.
5) Derived Attribute:
Symbol of Derived Attribute: Attribute
2.26
B.C.A. (Sem. - I) Database Management
Systems
2.27
B.C.A. (Sem. - I) Database Management
Systems
Example:
1 M
Teacher teaches Student
2.28
B.C.A. (Sem. - I) Database Management
Systems
8) Line:
Symbol of line:
It link attribute to entity and entity to attribute.
D) Example of Entity Relationship Diagram:
ERD for Employee Department Relationship.
2.29
B.C.A. (Sem. - I) Database Management
Systems
Although the basic E-R concepts can model most database features, some
aspects of a database may be more aptly expressed by certain extensions to the
basic E-R model. In this section, discuss the extended E-R features of
specialization, generalization, higher and lower-level entity sets, attribute
inheritance, and aggregation. There are four extended features of entity
relationship diagram.
A) Generalization:
Generalization is the process of extracting shared characteristics from two or
more classes, and combining them into a generalized super class. Shared
characteristics can be attributes, associations, or methods.
A generalization is defined as a broad statement or an idea that applies to a
group of people or things. Often times, generalizations are not entirely true,
because there may be examples of individuals or situations wherein the
generalization does not apply. For example, person is the higher-level entity
set and customer and employee are lower-level entity sets as shown in below
diagram
Perso
n
ISA
Employee Customer
ISA
Secretary
Officer Engineer
2.30
B.C.A. (Sem. - I) Database Management
Systems
Is A
A
Example:
2.31
B.C.A. (Sem. - I) Database Management
Systems
Here the relation between center and course is acting as an entity in relation
with visitor.
2.32
B.C.A. (Sem. - I) Database Management
Systems
D) Attribute Inheritance:
A crucial property of the higher- and lower-level entities created by
specialization and generalization is attribute inheritance. The attributes of
the higher-level entity sets are said to be inherited by the lower-level entity
sets. Attribute inheritance applies through all tiers of lower-level entity sets;
thus, instructor and secretary, which are subclasses of employee, inherit the
attributes ID, name, and address from person, in addition to inheriting salary
from employee. A lower-level entity set (or subclass) also inherits
participation in the relationship sets in which its higher-level entity (or super
class) participates. Like attribute inheritance, participation inheritance applies
through all tiers of lower-level entity sets.
For example, suppose the person entity set participates in a relationship
person dept with department. Then, the student, employee, instructor and
secretary entity sets, which are subclasses of the person entity set, also
implicitly participate in the person dept relationship with department. The
above entity sets can participate in any relationships in which the person
entity set participates.
Example:
2.33
B.C.A. (Sem. - I) Database Management
Systems
2.34
B.C.A. (Sem. - I) Database Management
Systems
2.35
B.C.A. (Sem. - I) Database Management
Systems
The Data Manager is the central software component of the DBMS also
knows as Database Control System. It is sometimes referred to as the
database control system. One of the functions of the data manager is to
convert operations in the user's queries coming directly via the query
processor or\ indirectly via an application program from the user's logical view
to a physical file system.
The data manager is responsible for interfacing with the file system as
shown. It is also the responsibility of the data Manager to provide the
synchronization in the simultaneous operations performed by concurrent
users and to maintain the backup and recovery operations.
4) Data Dictionary:
Data dictionary stores information about the structure of the database. Data
Dictionary is a repository of description of data in the database It contains
information about Data - names of the tables, names of attributes of each
table, length of attributes, and number of rows in each table. It consists of
detailed information on physical database design such as storage structure,
access paths, files and record sizes.
5) Data Files:
It contains the data portion of the database. It store the database itself.
6) Compiled DML:
The DML complier converts the high level queries into low level file access
commands known as compiled DML.
7) End Users:
End Users are the people who interact with the database through applications
or utilities
Examples of ERD:
1) Library Management System:
Entities:
Person, Librarian, Book, Publisher
2.36
B.C.A. (Sem. - I) Database Management
Systems
2.37
B.C.A. (Sem. - I) Database Management
Systems
3) Student System :
Entities :
Administrator, student, Course, Department, Attendance,Exam
2.38
B.C.A. (Sem. - I) Database Management
Systems
2.39
B.C.A. (Sem. - I) Database Management
Systems
Entities :
a) Agent
b) Policies
c) Client
d) Monthly premium
Relationship :
a) The agent table is related with policies table as a one to many relationship
b) The insurance table is related with client table as many to one relationship.
c) The agent table is related with policies table as one to many relationship
AgentName Amount
AgentNo
1 M
Collects
Agent Monthly premium
1
Sells on
M
PoliciesNo M
to Client ClientNo
Policies
1
ClientName
ISA
PoliciesName
2.40
B.C.A. (Sem. - I) Database Management
Systems
a) Company
b) Department
c) Supervisor
d) Employee
Relationship :
a) The company table may have one to many relationship with department
table
b) The Department table may have one to one relationship with Supervisor
table.
c) The Department table may have one to many relationship with employee
tables.
d) The employee Table may have one to one relationship with department table.
Entity Relationship Diagram :
C_address
D_no
C_name
D_name
M
Company
has Department
1 1 1
has
1
have Supervisor S_no
M S_name
Employee
E_no
E_name
Fig : 2.32
7) Daulatnagar Electric Supply Company is a distributor of electricity in a small
town having about 20,000 consumers. The consumers are divided into three
categories. Agricultural, Commercial, Domestic for whom different rates are
2.41
B.C.A. (Sem. - I) Database Management
Systems
charged. The bills are made according to the meter readings which are paid
by the consumers.
Entities :
a) Distributor b) Consumer c) Bill
Relationship :
a) Table distributor may have one to many relationship with consumer table
b) Table consumer may have one to many relationship with table bill
Entity Relationship Diagram :
D_no
D_name
Distributor
1
have
C_no
M
M 1
Bill has Paid Consumer
C_name
Bill_no
Bill_amt
ISA
Fig : 2.33
8) In a nursery, the plants are sold to the customers. These plants are flowering
and non-flowering only. Nutrients are given to the plant with some quantity.
Nutrients includes pesticides, watering and manure :
Entities :
a) Nursery b) Plant c) Customer d) Nutrients
2.42
B.C.A. (Sem. - I) Database Management
Systems
Relationship :
a) The table nursery may have one to many with relationship plant table
b) The customer table may have one to many with relationships plant table.
c) The nutrient table may have many
d) to one relationship with plant table.
Entity Relationship Diagram :
Fig : 2.34
Review Questions
2.43
B.C.A. (Sem. - I) Database Management
Systems
2.44
B.C.A. (Sem. - I) Database Management
Systems
2.45