You are on page 1of 29

Database

System 1
Instructor : Ahsan Khan
Traditional file processing System
 When computer-based data processing was first available, there were no databases.

 To be useful for business applications, computers had to store, manipulate, and retrieve large files of data.

 Computer file processing systems were developed for this purpose.

 Although these systems have evolved over time, their basic structure and purpose have changed little over several
decades.

 As business applications became more complex, it became evident that traditional file processing systems had a number of
shortcomings and limitations (described next).

 As a result, these systems have been replaced by database processing systems in most business applications today.

 Nevertheless, you should have at least some familiarity with file processing systems since understanding the problems and
limitations inherent in file processing systems can help you avoid these same problems when designing database systems.
File Processing Systems at
Pine Valley Furniture
Company
 Early computer applications at Pine Valley Furniture (during the
1980s) used the traditional file processing approach.

 This approach to information systems design met the data


processing needs of individual departments rather than the
overall information needs of the organization.

 The information systems group typically responded to users’


requests for new systems by developing (or acquiring) new
computer programs for individual applications such as
inventory control, accounts receivable, or human resource
management.

 No overall map, plan, or model guided application growth.

 Three of the computer applications based on the file


processing approach are shown in Figure 1-2.
 The systems illustrated are Order Filling, Invoicing, and Payroll.

 The figure also shows the major data files associated with each application.

 A file is a collection of related records. For example, the Order Filling System has three files:
Customer Master, Inventory Master, and Back Order.

 Notice that there is duplication of some of the files used by the three applications, which is typical of
file processing systems.
Disadvantages of File Processing Systems
 Several disadvantages associated with conventional file processing systems are listed in Table 1-2 and described briefly below.

 It is important to understand these issues because if we don’t follow the database management practices described in this book, some of these
disadvantages can also become issues for databases as well.

 PROGRAM-DATA DEPENDENCE

 The close relationship between data stored in files and the software programs that update and maintain those files. Any change in data organization or format
requires a change in all the programs associated with those files. 

 File descriptions are stored within each database application program that accesses a given file.

 For example, in the Invoicing System in Figure 1-2, Program A accesses the Inventory Pricing File and the Customer Master File.

 Because the program contains a detailed file description for these files, any change to a file structure requires changes to the file descriptions for
all programs that access the file.

 Notice in Figure 1-2 that the Customer Master File is used in the Order Filling System and the Invoicing System.

 Suppose it is decided to change the customer address field length in the records in this file from 30 to 40 characters.

 The file descriptions in each program that is affected (up to five programs) would have to be modified.
DUPLICATION OF DATA

 Because applications are often developed independently in file processing systems, unplanned duplicate data files are
the rule rather than the exception.

 For example, in Figure 1-2 the Order Filling System contains an Inventory Master File, whereas the Invoicing System
contains an Inventory Pricing File.

 These files contain data describing Pine Valley Furniture Company’s products, such as product description, unit price,
and quantity on hand.

 This duplication is wasteful because it requires additional storage space and increased effort to keep all files up to date.

 Data formats may be inconsistent or data values may not agree (or both).

 Reliable metadata are very difficult to establish in file processing systems.

 For example, the same data item may have different names in different files, or conversely, the same name may be
used for different data items in different files.
LIMITED DATA SHARING
 With the traditional file processing approach, each application has its own private files, and users have
little opportunity to share data outside their own applications.

 Notice in Figure 1-2, for example, that users in the Accounting Department have access to the Invoicing
System and its files, but they probably do not have access to the Order Filling System or to the Payroll
System and their files.

 Managers often find that a requested report requires a major programming effort because data must be
drawn from several incompatible files in separate systems.

 When different organizational units own these different files, additional management barriers must be
overcome.
LENGTHY DEVELOPMENT TIMES
 With traditional file processing systems, each new application requires that the developer essentially
start from scratch by designing new file formats and descriptions and then writing the file access logic
for each new program.

 The lengthy development times required are inconsistent with today’s fast-paced business
environment, in which time to market (or time to production for an information system) is a key
business success factor.
EXCESSIVE PROGRAM
MAINTENANCE
 The preceding factors all combined to create a heavy program maintenance load in organizations
that relied on traditional file processing systems.

 In fact, as much as 80 percent of the total information system’s development budget might be
devoted to program maintenance in such organizations.

 This in turn means that resources (time, people, and money) are not being spent on developing new
applications.
Data Redundancy:
•It is possible that the same information may be duplicated in different files.this leads to data
redundancy results in memory wastage.

Other Disadvantages

Difficulty in accessing data

Need to write a new program to carry out each new task

Data isolation — multiple files and formats

Hard to add new constraints or change existing ones


how do we overcome the flaws of file
processing?
We follow the database approach
We first begin by defining some core concepts that are fundamental in understanding the
database approach to managing data. We then describe how the database approach can
overcome the limitations of the file processing approach.
 It is important to note that many of the disadvantages of file processing we have mentioned can also be
limitations of databases if an organization does not properly apply the database approach.

 For example, if an organization develops many separately managed databases (say, one for each division
or business function) with little or no coordination of the metadata, then uncontrolled data duplication,
limited data sharing, lengthy development time, and excessive program maintenance can occur.

Thus, the database approach, which is explained in the next section, is as much a way to manage
organizational data as it is a set of technologies for defining, creating, maintaining, and using these data
Why database approach?

Two main factor


In TFPS the definition of data is embedded in the application programs rather than being stored separately
and independently.
There is no control over the access and manipulation of data in TFPS.

To overcome above problems database approach was developed


Data models
Graphical systems used to capture the nature and relationships among data.
Data Model gives us an idea that how the final system will look like after its complete
implementation. It defines the data elements and the relationships between the data
elements.
Data Models is the concept of tools that re develop to Summarize the description of
Database
It Describe how the logical structure of data base is developed
Data Models Tools describe
•Data
•Data Relationships
•Data Semantics
•Consistency Constraints (Constraints are essentially rules by which data in tables must abide)
Data Models are used to show how data is stored, connected, accessed and updated in
the database management system.
Here, we use a set of symbols and text to represent the information so that members
of the organization can communicate and understand it.
Though there are many data models being used nowadays but the Relational model
is the most widely used model. Apart from the Relational model, there are many
other types of data models about which we will study in details
Hierarchical Model
Network Model
Relational Model
Entity-Relationship Model
Object-Oriented Data Model
Object-Relational Data Model
Semi-Structured Data Model
Hierarchical Model
Hierarchical Model was the first DBMS model. This
model organizes the data in the hierarchical tree
structure. The hierarchy starts from the root which
has root data and then it expands in the form of a tree
adding child node to the parent node. This model
easily represents some of the real-world relationships
like food recipes, sitemap of a website etc. Example:
We can represent the relationship between the shoes
present on a shopping website in the following way:
One-to-many relationship: The data here is organised in a tree-like structure where the
one-to-many relationship is between the datatypes. Also, there can be only one path
from parent to any node. Example: In the above example, if we want to go to the node
sneakers we only have one path to reach there i.e through men's shoes node.
Parent-Child Relationship: Each child node has a parent node but a parent node can
have more than one child node. Multiple parents are not allowed.
Deletion Problem: If a parent node is deleted then the child node is automatically
deleted.
Pointers: Pointers are used to link the parent node with the child node and are used to
navigate between the stored data. Example: In the above example the 'shoes' node
points to the two other nodes 'women shoes' node and 'men's shoes' node.
Advantages of Hierarchical Model
It is very simple and fast to traverse through a tree-like structure.
Any change in the parent node is automatically reflected in the child node so, the integrity of
data is maintained.
Disadvantages of Hierarchical Model
Complex relationships are not supported.
As it does not support more than one parent of the child node so if we have some complex
relationship where a child node needs to have two parent node then that can't be represented
using this model.
If a parent node is deleted then the child node is automatically deleted.
Network Model
This model is an extension of the hierarchical model.
It was the most popular model before the relational
model. This model is the same as the hierarchical
model, the only difference is that a record can have
more than one parent. It replaces the hierarchical tree
with a graph. Example: In the example below we can
see that node student has two parents i.e. CSE
Department and Library. This was earlier not possible
in the hierarchical model.
Features of a Network Model
Ability to Merge more Relationships: In this model, as there are more relationships
so data is more related. This model has the ability to manage one-to-one relationships
as well as many-to-many relationships.
Many paths: As there are more relationships so there can be more than one path to
the same record. This makes data access fast and simple.
Circular Linked List: The operations on the network model are done with the help of
the circular linked list. The current position is maintained with the help of a program
and this position navigates through the records according to the relationship.
Advantages of Network Model
The data can be accessed faster as compared to the hierarchical model. This is because the
data is more related in the network model and there can be more than one path to reach a
particular node. So the data can be accessed in many ways.
As there is a parent-child relationship so data integrity is present. Any change in parent
record is reflected in the child record.
Disadvantages of Network Model
As more and more relationships need to be handled the system might get complex. So, a
user must be having detailed knowledge of the model to work with the model.
Any change like updating, deletion, insertion is very complex.
Entity-Relationship Model
Entity-Relationship Model or simply ER Model is a high-level data model diagram. In this model,
we represent the real-world problem in the pictorial form to make it easy for the stakeholders to
understand. It is also very easy for the developers to understand the system by just looking at the
ER diagram. We use the ER diagram as a visual tool to represent an ER Model. ER diagram has
the following three components:
Entities: Entity is a real-world thing. It can be a person, place, or even a concept. Example:
Teachers, Students, Course, Building, Department, etc are some of the entities of a School
Management System.
Attributes: An entity contains a real-world property called attribute. This is the characteristics of
that attribute. Example: The entity teacher has the property like teacher id, salary, age, etc.
Relationship: Relationship tells how two attributes are related. Example: Teacher works for a
department.
ENTITIES
Customers and orders are objects about
which a business maintains information.
They are referred to as “entities.”
An entity is like a noun in that it describes
a person, a place, an object, an event, or a
concept in the business environment for
which information must be recorded and
retained.
CUSTOMER and ORDER are entities in
Figure 1-3a.
Entity-Relationship Model
Attributes: An entity contains a real-world property called attribute. This is the characteristics of that attribute.
Example: The entity teacher has the property like teacher id, salary, age, etc.

 The data you are interested in capturing about the entity (e.g., Customer Name) is called an attribute.

 Data are recorded for many customers. Each customer’s information is referred to as an instance of
CUSTOMER.
 RELATIONSHIPS A well-structured database establishes the relationships between entities that exist in organizational data so that desired information
can be retrieved.

 Most relationships are one-to-many (1:M) or many-to-many (M:N). A customer can place (the Places relationship) more than one order with a company.

 However, each order is usually associated with (the Is Placed By relationship) a particular customer.

 Figure 1-3a shows the 1:M relationship of customers who may place one or more orders; the 1:M nature of the relationship is marked by the crow’s foot
attached to the rectangle (entity) labeled ORDER. This relationship appears to be the same in Figures 1-3a and 1-3b.

 However, the relationship between orders and products is M:N. An order may be for one or more products, and a product may be included on more than
one order.

 It is worthwhile noting that Figure 1-3a is an enterprise-level model, where it is necessary to include only the higher-level relationships of customers,
orders, and products.

 The project-level diagram shown in Figure 1-3b includes additional level of details, such as the further details of an order.
In the above diagram, the entities are Teacher and Department. The attributes
of Teacher entity are Teacher_Name, Teacher_id, Age, Salary, Mobile_Number. The
attributes of entity Department entity are Dept_id, Dept_name. The two entities are
connected using the relationship. Here, each teacher works for a department.
Features of ER Model
Graphical Representation for Better Understanding: It is very easy and simple to
understand so it can be used by the developers to communicate with the stakeholders.
ER Diagram: ER diagram is used as a visual tool for representing the model.
Database Design: This model helps the database designers to build the database and
is widely used in database design.
Advantages of ER Model
Simple: Conceptually ER Model is very easy to build. If we know the relationship between the attributes and the
entities we can easily build the ER Diagram for the model.
Effective Communication Tool: This model is used widely by the database designers for communicating their ideas.
Easy Conversion to any Model: This model maps well to the relational model and can be easily converted relational
model by converting the ER model to the table. This model can also be converted to any other model like network
model, hierarchical model etc.
Disadvatages of ER Model
No industry standard for notation: There is no industry standard for developing an ER model. So one developer
might use notations which are not understood by other developers.
Hidden information: Some information might be lost or hidden in the ER model. As it is a high-level view so there
are chances that some details of information might be hidden.

You might also like