Operations on Files


Retrieval and Update Operations

When we work with files, we usually do two types of operations: retrieval and update. Retrieval operations help us find specific records in the file and look at their data. Update operations change the file by adding, removing, or modifying records.

Selection Conditions

To do either operation, we may need to specify a condition that the records must meet. For example, we might want to retrieve all the records where the salary is greater than or equal to $30,000. This is called a selection condition.

Selection conditions can be simple or complex. A simple condition might only use one field, like Ssn or Department. A complex condition might combine multiple fields and use comparison operators like > or ≤.

Searching for Records

When we search for records based on a selection condition, the system looks for records that match the condition and then checks to make sure they meet all the criteria. If we have a complex condition, the system may need to break it down into simpler parts to search efficiently.

Methods of Accessing and Manipulating Files

When you search for information in computer file. You start with the first record that matches our search. Then you can read or update that record, or find the next record that matches our search. You can also delete, modify, or insert records. When you are done, close the file.

There are various ways to do these operations. These depend on the computer system you are using. You can use high-level programs like database management systems to do these operations.

Record-at-a-time vs. Other Operations

Some operations are called "record-at-a-time" because they apply to a single record. Others can find all records that match our search, find a certain number of records, or retrieve records in a specific order.

You might also need to reorganize our file periodically to keep it organized and efficient.

File Organization and Access Methods

File is organized is different from the way to access it. File organization refers to how the data is stored and structured, while access methods are the ways you can find and manipulate the data in the file. You can use different access methods for the same file organization, but some access methods only work with certain types of file organizations.

Organizing Files

Sometimes you use certain ways to find information in files. Some files do not change much, while others change a lot. A good way to organize files is to make it easy to do the things you do often. For example, if you have a file of employees. You usually look for them by their Social Security number (SSN). You should organize the file so that you can find them easily using their SSN.

If you have another application that needs to group employees by department for paychecks. You should organize the file differently. So it is easy to find employees in each department. But this way might not work well for finding employees by SSN. Sometimes you can not organize a file to make everything easy. So you have to find a balance between what you need to do and what you can do easily.

Different File Organization Methods

You can use different methods to organize files, like ordering, hashing, and indexing. You can also use different ways to add or remove information from files.

Conclusion

In conclusion, retrieval and update operations are essential when working with files. Selection conditions play a vital role in finding specific records, whether they are simple or complex. Searching for records can be done in various ways. Different access methods can be used to manipulate data in the file. Efficient file organization is crucial to access data easily and quickly, and different file organization methods, such as ordering, hashing, and indexing, can be used. Finally, balancing between the need to perform operations and the ease of organizing files is crucial. Overall, understanding these concepts is essential in managing and manipulating data in files effectively.

Updated on: 18-May-2023

381 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements