Identify fields and records in a single-table database

Resources | Subject Notes | Computer Science

Databases: Fields and Records in a Single-Table Database

Introduction

In a database, information is organized in a structured way. A fundamental concept is the use of tables to store data. A single-table database consists of one table that holds all the information. This table is made up of fields and records.

Fields

A field represents a specific attribute or piece of information about the data being stored. Each field has a name and a defined data type. Think of a field as a column in a spreadsheet.

  • Fields have names (also called field names or column names).
  • Fields have data types (e.g., text, number, date).

Examples of fields in a database about students might include:

  • Student Name
  • Student ID
  • Date of Birth
  • Email Address

Records

A record represents a single instance of the data being stored. It contains the values for all the fields defined in the table. Think of a record as a row in a spreadsheet.

Each record in a single-table database will have the same number of fields, even if the data in those fields is different for each record.

For example, a record might contain the following information for one student:

Student Name Student ID Date of Birth Email Address
Alice Smith 12345 2002-03-15 alice.smith@example.com
Bob Johnson 67890 2001-11-20 bob.johnson@example.com

Example of a Single-Table Database

Consider a database to store information about library books. The table might have the following fields:

  • Book Title (text)
  • Author (text)
  • ISBN (text)
  • Publication Year (number)

Each row in this table would represent a single book, with values for each of these fields.

Suggested diagram: A table with columns representing fields and rows representing records.

Summary

In summary, fields define the structure of the data, while records contain the actual data for individual instances. Understanding fields and records is crucial for working with databases.