Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Operations on Files
When working with files in a DBMS, two fundamental types of operations are performed: retrieval (finding and reading records) and update (inserting, deleting, or modifying records). Both use selection conditions to identify target records.
Selection Conditions
A selection condition specifies criteria that records must meet. Conditions can be
-
Simple Uses one field (e.g.,
Ssn = '123-45-6789') -
Complex Combines multiple fields with comparison operators (e.g.,
Department = 'Sales' AND Salary ≥ 30000)
File Operations
The typical sequence of file operations
1. Open file 2. Find first record matching selection condition 3. Read / Update / Delete the record 4. Find next matching record (repeat as needed) 5. Insert new records (if required) 6. Close file
Operations can be record-at-a-time (process one record) or set-at-a-time (find all matching records at once). Periodic reorganization may be needed to maintain efficiency.
File Organization vs Access Methods
File organization is how data is physically stored and structured. Access methods are the techniques used to find and manipulate data within that structure. Different access methods can work on the same organization, but some methods require specific organizations.
File Organization Methods
| Method | Description | Best For |
|---|---|---|
| Heap (Unordered) | Records stored in insertion order | Fast inserts, full-table scans |
| Ordered (Sequential) | Records sorted by a key field | Range queries, sorted access |
| Hashing | Hash function maps key to storage location | Exact match lookups |
| Indexing | Separate index structure points to records | Fast retrieval on indexed fields |
The choice of organization depends on the most frequent operations. For example, if employees are usually looked up by SSN, the file should be organized for fast SSN-based access. If another application groups employees by department, a different organization may be needed. Often, a balance must be found between competing access patterns.
Conclusion
File operations in DBMS involve retrieval and update using selection conditions. The choice of file organization (heap, ordered, hashed, indexed) and access method determines how efficiently records can be found and manipulated. Balancing the most frequent operations against organizational constraints is key to efficient file management.
