DBMS
DBMS
DBMS
MARY
UNIVERSITY
Fundamentals of Database Systems
INDIVIDUAL ASSIGMENT
Record Storage and Primary File Organization
Record Storage:
Record storage refers to the physical representation and arrangement of data records within a
database. A record is a collection of related data fields or attributes that describe a specific entity or
object. For example, in a database of employees, each record might contain fields such as name,
employee ID, department, and salary.
2. Operations on Files
Files in a database management system support various operations for manipulating and managing
data. These operations allow users to interact with the data stored in files efficiently. Here are some
common operations performed on files:
Create: The create operation is used to generate a new file in the database. It involves specifying
the file's name, structure, and location. During the creation process, the necessary file control
blocks and data structures are allocated, and initial metadata may be set up.
Open: The open operation is used to establish a connection between a file and a user or
application program. By opening a file, users gain access to its contents and can perform read,
write, or other operations on the file.
Close: The close operation terminates the connection between a file and a user or application
program. It ensures that any changes made to the file are saved and releases any system
resources associated with the file.
Read: The read operation retrieves data from a file and transfers it to a user or application
program for processing. It typically involves specifying the starting position and the number of
records or bytes to be read. Read operations can be sequential or random, depending on the file
organization.
Write: The write operation inserts or updates data in a file. It requires specifying the data to be
written and the location where it should be stored. Like read operations, write operations can be
sequential or random, depending on the file organization.
Update: The update operation modifies existing data in a file. It involves locating the desired
record or records and changing specific attributes or fields within those records. Updates can be
performed based on specified conditions or on a specific record identifier.
Delete: The delete operation removes data from a file. It involves locating the record or records
to be deleted and eliminating them from the file. Deletion can be based on specified conditions
or a specific record identifier
Files of unordered records, also known as heap files, are a type of primary file organization where
records are stored sequentially without any particular order. In heap files, new records are simply
appended to the end of the file as they are inserted, without any consideration for their physical
placement or sorting based on key values.
4. Files of Ordered Records (Sorted Files)
Files of ordered records, also known as sorted files, are a type of primary file organization where
records are stored in a specific order based on the values of one or more key fields. In sorted files, the
physical placement of records reflects their logical order, allowing for efficient searching and retrieval
operations.
5. Hashing Techniques
Hashing techniques are widely used in database management systems to provide efficient and direct
access to data based on key values. Hashing involves applying a hash function to a key value to
compute a hash code or hash address. The hash address is then used to determine the storage
location of the corresponding record. Here are some common hashing techniques:
Division Hashing:
Division hashing involves dividing the key value by the number of available storage locations (hash
buckets) and using the remainder as the hash address.
Multiplication Hashing:
Multiplication hashing uses the key value multiplied by a constant factor (between 0 and 1) and
extracts the fractional part of the result. The fractional part is then multiplied by the number of
buckets to obtain the hash address.
Folding Hashing:
Folding hashing divides the key value into equal-sized partitions, which are then added together. The
sum is then reduced to the desired number of digits, which becomes the hash address. Folding
hashing is often used when the key values are long or have a significant number of digits.
Universal Hashing:
Universal hashing uses a family of hash functions and selects a specific hash function randomly or
based on a predetermined pattern. Universal hashing helps mitigate the risk of clustering and
provides a higher level of security against intentional collisions.
Perfect Hashing:
Perfect hashing is a technique that eliminates collisions entirely by constructing a hash function
specifically tailored to a set of key values. It ensures that each key maps to a unique hash address.
Perfect hashing is useful when the set of key values is known in advance and remains static.