Resources | Subject Notes | Computer Science
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.
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.
Examples of fields in a database about students might include:
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 |
Consider a database to store information about library books. The table might have the following fields:
Each row in this table would represent a single book, with values for each of these fields.
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.