Versatile: The data in the flat files are easily supported by various programs like word processor, spreadsheet and is familiar with any operating system
Consumes less space: Flat file saves the memory of computer as it needs less disk space
Easy to use: Flat file is easy to use and anyone having basic computer knowledge can create it
Student ID
Name
Grade
Address
72
Paul Brady
B
175 Rathmines Road
89
Sami Camphell
A
87 Pembroke Road
101
Mike Smith
C
48 Talbot Street
Figure 1: Flat File
Sequential File
The base form of file organisation is the sequential file. A new record is simply added to the last block in sequential file. If there is insufficient space in the last block then a new block is added to the file. Therefore, insertion into a sequential file is very efficient. For example, suppose we have a sequential file of student records. As each student enrols with the university, a new student record is created and added to the end of the file. However, searching for a record in a sequential file involves a linear search through the file, record by record. Hence, for a file of N records, N/2 records will be searched on average. This makes searching through a sequential file that is more than a few blocks long a slow process. Another problem arises in relation to deletion activity performed against sequential files. To delete a record we first need to retrieve the appropriate block from disk. The relevant record is marked as deleted and then written back to disk. Because the deleted records are not reused, a database administrator normally has to reorganise a sequential file periodically to reclaim deleted space. One disadvantage of sequential file organization is that we must access an index
Structure to locate data, or must use binary search, and that results in more I/O operations.
Figure 2: Sequential File
Indexed File
In indexed file records are arranged in the form of index. Every record contained in a field has the key which identifies the records and finds the sequence in which it is accessed compared to other records. We can use alternate indexes in indexed file i.e. we can use record key to get access to the file, for e.g. in a certain department we can access the file using faculty department rather than using faculty number. Indexed files are accessed sequentially, randomly or dynamically and we must open the indexed file before processing and close when it is not in use. We must open the file in input-output mode when adding new records in indexed file and we must consider that the key contained in indexed file must not be the same.
Some advantages of indexed file are as follows
Processing is easy for indexed file
In indexed file we can search and find records even from huge files very fast
In indexed file we can use any field of record as the key which can be numerical
Relative File
In relative file records are arranged by their relative key (record number). For example, in a certain file let the first record number is 1 then second record number will be 2, third record number will be 3 and so on. In relative file we can access the file with the help of sequence number of records without accessing other records coming before that record. Relative file can be accessed randomly or sequentially. If we open relative file in output mode then we should write the record in increasing order of the keys i.e. we should write fourth record with key 4 before writing the fifth record with key 5. Some advantages of relative files are as follows
Relative files are easy for processing
In relative files we can easily access the record by knowing the key of the record
Hierarchical Database
Hierarchical database is based on the tree data structure, which is similar to uprooted tree turned upside down. They are large database consisting of large amount of data. Hierarchical database is easy to understand and it is concept based database. Chart of the organisation is one of the examples of it. Hierarchical database are very efficient for data management. The hierarchical structure of the database and the occurrence are similar but functions differently to the field and the data item. For example: name, Griffith college, here name is the category and Griffith college is the value. The hierarchical database is ideal for modelling the one to many relationships between entities found naturally in many organisations. A typical example of hierarchical database system is IMS/VS â€" Information Management System/Virtual Storage database which is found on many IBM mainframes.
Some advantages of hierarchical database are as follows
The hierarchical database is very fast due to the implementation of parent to child relationship so that after finding the record the system does not have to search the index
Due to the simple tree structured database it is easy to understand