Fields, Records and Files

Fields, Records and Files

Fields

  • A field is the smallest unit of data in a record and it contains an individual piece of data.
  • Types of data that can be held in a field might include strings (text), integers (whole numbers), floating point numbers (numbers with decimal points), or Boolean values (true or false).
  • Each field in a record has a unique field name which is used to identify it.
  • The type of data which can be held in a field is determined by the data type of that field.
  • Fields, like array elements, can be accessed directly using their index number.

Records

  • A record is a collection of related fields that can be treated as a single unit.
  • In database terminology, a record corresponds to a row in a table.
  • Each record is made up of several fields and each field in a record holds a unique piece of data.
  • Primary key is a special field in a record that makes each record unique and ensures that no two records are identical.

Files

  • A file is a collection of related records.
  • In the context of databases, a file corresponds to a table where each row is a record and each column is a field.
  • The structure of a file is defined in its file specification or schema, which includes the names of fields, their order, and their data types.
  • Files can be sequential files, where records must be accessed in the same order they were added, or random access files, where records can be accessed in any order.
  • Files can also be indexed, meaning they have an index that allows quick access to any record, similar to the index of a book.
  • Text files store data in human-readable form, while binary files store data in a format that can only be read by a computer.
  • Files are stored on a permanent storage medium, such as a hard disk, which allows data to be retained even when the computer is turned off.