Sequential Access in DBMS
Reading or writing records in the order that they are stored is known as sequential access. The general sequential access procedure is explained in the subsequent steps:
- File Opened: The records-containing file is opened.
- Initialize Pointer: The beginning of the file is the pointer’s initial value.
- Read/Write Records: Each record is read or written sequentially, one after the other.
- Check for End of File: Following the processing of each record, an attempt is made to see if the file’s end has been reached.
- Close the File: The file is closed after all activities are finished.
Example : Consider a database table called Inventory that contains the “product_id”, “product_name”, and “quantity_in_stock” data. You must create an inventory report that includes a list of every product and its quantity.
Steps for Sequential Access
- Open the Inventory Table: To write the data to the file, the file pointer needs to be set to the start of the file; the Inventory table is opened to this end.
- Read every product record: Read each record one by one in the sequence they are stored.
- Extract Data: The identified attributes to select are the product name, the product id, and the quantity in stock according to the defined record.
- Procedure for Report: Create a report of stock-in with the details of the current stock of each of the products in your list.
- Proceed Until File End: Thus, to make it possible for each of the products to be processed during the report, the reporter should move through the Inventory table repeatedly to check on all the records in the table.
Sequential File Organization and Access in DBMS
Sequential File Organization is a basic technique employed in a database management system DBMS for storing and retrieving data. It is mostly applied when data access is sequential or in a particular order.
In this article, we will describe what sequential file organization is, define some fundamental terms about the method, depict a diagram of the sequential file organization, and give an insight into the process of accessing data sequentially in the method.
Contact Us