Before starting our discussions of reading and writing, we need to understand the nature of databases. A database is a finite set of records. At any point in time there is a finite set of physical databases(1) active in the system. So, at a point in time, let D be the database defined by the union of all the physical databases active in the system.
Each record in D is a set of ordered attribute-value pairs where the attribute is the name of the field within the record and, as these databases are not in first normal form, the value is an ordered n-tuple of atomic data values (or simply values). Therefore, an ordered 3-tuple <record name, field name, atom id>, which we call a name, is needed to uniquely identify a value in D. For example, given a record R with field F where the value of F is an ordered pair, the name <R, F, 2> identifies the second value in that ordered pair. The process of reading/writing from/to a database is the process of reading/writing these values as identified by names.
The read operation is a binary function. It takes as input a database D and a name. It returns the value identified by name if name is in D, otherwise it returns ε, a null value to indicate that name was not in D. The write operation is a ternary predicate. It takes as input a database D, a name, and the value to be written. If name is in D, the value is written there and returns true, otherwise it returns false.
Reading and writing sets of values are simply a matter of performing individual reads and writes using sets of appropriate input for each.
Table of Contents Next Chapter