0% found this document useful (0 votes)
13 views

File and Database Design

Uploaded by

Vishnupriya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

File and Database Design

Uploaded by

Vishnupriya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

File and Database

Design
File Organization
• A file is organized to ensure that records are available for
processing.
• It should be designed in line with the activity and volatility
of the information and the nature of the storage media
and devices.
File Organization
• There are four methods of organizing files
• Sequential organization means storing and sorting in physical, contiguous
blocks within files on tape or disk according to key.
• Indexed sequential organization stores records sequentially but uses an
index to locate records. Records are related through chaining using
pointers.
• Inverted list organization uses an index for each key type. Records are
not necessarily in a particular sequence.
• Direct access organization has records placed randomly throughout the
file. Records are updated directly and independently of the other records.
Database
• A DataBase is a collection of interrelated data stored with
minimum redundancy to serve many users quickly and efficiently.
• The general objective is to make information access easy, quick,
inexpensive, and flexible for the user.
• The primary objectives are fast response time to inquiries, more
information at low cost, control of redundancy, clarity and ease
of use, data and program independence, accuracy and integrity
of the system, fast recovery, privacy and security of information,
and availability of powerful end user languages.
Elements of file structure
Elements of file structure
• Byte: Byte is a set of eight bits representing a character. It
is the smallest addressable unit in a computer system.
• Data Item: A combination of more than one byte is called a
data item or element which defines attributes of object.
The data item is also called field.
• Record: The data items related to the object are combined
into a record.
• File: It consists of a collection of related records.
Elements of file structure
• The size of a file depends upon the size of memory or the
storage space of computer system.
• File has two types of characteristics which help
determine the file structure.
• File Activity: It specifies the percentage values of the
records which are processed in single run.
• File Volatility: This specifies that the properties of record
change while processing.
Elements of file structure
• Database: It is the upper layer in hierarchy of file
structure. It is a set of interrelated files for real time
processing. It contains the data, which is required for
problem solving and can be used by several users.
File Organization
• File organization is the methodology that is applied to
structured computer files.
• File organization refers to the way records are physically
arranged on a storage device.
File Organization
• Record type refers to whether records in a file are all the
same length are of varying in length or use other
conventions to define where one record ends and another
begins.
• Record access refers to the method used to read records
from or write records to a file regardless of its
organization.
File Organization
• Sequential File Organization
• A sequentially organized file consists of records arranged
in the sequence in which they are written to the file,
• i.e., the first record written is the first record in the file,
the second record written is the second record in the file
and so on.
• As a result, records can be added only at the end of the
file.
File Organization
• Sequential File Organization
• Sequential files are usually read sequentially, starting with the
first record in the file.
• Sequential files with a fixed length record type stored on disk
can also be accessed by relative record number (direct access).
• A sequential file contains records organized by the order in
which they were entered. The order of the records is fixed.
Records in sequential files can be read or written only
sequentially
File Organization
• Relative File Organization
• Within a relative file are numbered positions, called cells. These cells are of
fixed equal length and are consecutively numbered from 1 to n, where 1 is the
first cell and n is the last available cell in the file. Each cell either contains a
single record or is empty.
• Records in a relative file are accessed according to cell number. A cell number
is a record’s relative record number where its location relative to the beginning
of the file.
• By specifying relative record numbers, you can directly retrieve, add or delete
records regardless of their locations. Within the cells, you can store records of
varying length as long as their size does not exceed the cell size.
File Access methods
• Sequential Access: In this file organization method,
records are stored in contiguous blocks of memory.
• Tape and disk are examples of physical devices of the
sequential organization method.
• In a sequential organization, adding a record in a file takes
place at the end of a file. It is not possible to add a record
at the middle of the file. All records in a sequential file
organization are scanned to access a particular record.
File Access methods
• Indexed-Sequential Access: Indexed-sequential file organization method also stores records in
the contiguous blocks of memory but it uses indexes to access a particular record.
• The disk storage is divided into three areas: primary area, overflow area and index area.
• Primary area is the main area of the disk where the records are stored by key or ID numbers.
The overflow area holds those records that cannot be placed in the logical sequence in the
primary area.
• The index area is the area on a disk that stores the key of records and the memory addresses
of their locations.
• Indexed-sequential organization takes less time to locate records than sequential file
organization.
• The disadvantage of this organization method is the extra space required to store the indexes.
File Access methods
• Chaining Access: In chaining access file organization
method, pointers are used with link records to each other.
• The pointers give the address of the next part of the same
class.
File Access methods
• Inverted List Access: Inverted list organization method is
similar to the indexed sequential organization method but
in indexed sequential organization, multiple indexes are
stored of a given key whereas in inverted list organization
a single index is used for a single key.
• The records stored in inverted list organization are not
necessarily stored in a particular sequence. They are
stored anywhere in the data storage area
Types of Files
• Master File : It contains the current information for a system.
For example, customer file, student file, telephone directory.
• Table File : It is a type of master file that changes infrequently
and stored in a tabular format. For example, storing Zip code.
• Transaction File : It contains the day-to-day information
generated from business activities. It is used to update or
process the master file. For example, addresses of the
employees.
Types of Files
• Temporary File : It is created and used whenever needed
by a system.
• Mirror File : They are the exact duplicates of other files.
Help minimize the risk of downtime in cases when the
original becomes unusable. They must be modified each
time the original file is changed.
Types of Files
• Log Files : Log filer contain copies of master and
transaction records in order to chronicle any changes that
are made to the master file. It facilitates auditing and
provides mechanism for recovery in case of system failure.
• Archive files : Backup files that contain historical versions
of other files
Database Design
• Database is a collection of data stored for a specific purpose.
• Database Management System (DBMS) is a software system
that allows to define, construct and manipulate databases that
are used for various purposes, such as for storing the
customer and financial information of an organization.
• DBMS provides significant features that make a database
system efficient and reliable. It also provides multiple User
Interfaces (UI) that help a user in interacting with the system.
Database Design
• The interfaces provided by DBMS include the query language for users
and the programming language interface for application programmers.
DBMS prevents the data redundancy problems that occur in other
management systems.
• DBMS provides security to the system by restricting the unauthorised
users to access the data of an organization. The backup and recovery
feature of DBMS allows to recover data that is lost due to hardware or
software failure.
• DBMS users can also perform a variety of operations, such as insert,
delete, retrieve and update on the database
Database Design
• Client-server architecture is used to retrieve information from the
databases.
• Clients are the machines that request for the services and server is the
machine that processes the requests send by the clients.
• Server processes the information based on the information that is stored
either in flat file database or relational database.
• A SQL Server can be defined as database , a collection of related data
items that can be stored in database objects, such as tables.
• Databases provide an easy way to access, manage and update the data in a
database.
Database Design
• two types of databases:
• Flat file database
• Relational database
Flat file Database
• Flat File Databases
• Flat file databases are simple text files that store data in a single table.
• Example of an enterprise that needs to store the sales information, such
as customer details (customer name, customer address and customer
mobile number), product details (product id, product features and
product price) and billing details (purchase date, discount, sale price).
• All the information will be stored in a single table if flat file system is
used in the enterprise.
Flat file Database
• Flat File Databases
• Flat file database is less flexible in terms of maintaining records. Consider that an
enterprise needs to maintain a database for every unit of product sold. The database is
maintained using flat file databases.
• The information stored in database includes customer details (customer id, customer
name and customer address), product details (product id, product name and product
features).
• Each time a product is sold, the information regarding customer details (provided the
customer is same) and product details (product name and product features) needs to be
repeated in the database.
• This additional information will bring redundancy in the database making it less flexible
Relational Database
• Relational Databases
• Relational databases are complex databases that store information in multiple
tables.
• In relational database, every table that stores data is linked to another table using
• a common column. Various software programs that store data in relational
database
• format are Oracle and Structure Query Language (SQL). Relational databases
• are flexible as compared to flat file databases in terms of accessing, managing and
• upgrading the data.
Relational Database
• Relational Databases
• Relational databases are complex databases that store information in multiple tables.
• In relational database, every table that stores data is linked to another table using
• a common column. Various software programs that store data in relational database
• format are Oracle and Structure Query Language (SQL). Relational databases
• are flexible as compared to flat file databases in terms of accessing, managing and
• upgrading the data.
• Consider the above example; in this case, you need to maintain the records
• for each unit of product sold. In relational databases, the information will be stored
• in separate tables depending on the similarity. All the customer information will be
• stored in the Customer_details table, all the product information will be stored in
• the Product_details table and all the billing information will be stored in the
• Billing_details table.
• Each time a product unit is sold, the records need to be updated in the
• billing information and not in Customer_detail and Product_details. In this way,
• data stored in relational databases avoids redundancy.

You might also like