Identify fields and records in a single-table database
📚 Databases – Identify Fields and Records in a Single‑Table Database
What is a Database?
A database is like a digital filing cabinet where information is stored in an organised way. Think of it as a big spreadsheet that can hold thousands of rows of data, but it’s stored on a computer so it can be searched, updated and shared instantly. 📂
Single‑Table Database
In a single‑table database, all the data lives in one table. This table is made up of fields (columns) and records (rows). Each record is one complete set of information about a single item. 🗂️
Fields vs. Records – The Analogy
- Fields are like the columns in a spreadsheet: Name, Age, Grade. They describe the type of data that can be stored in that column. - Records are like the rows: each row holds the data for one person, one product, or one event. Imagine a library catalogue: the fields are “Title”, “Author”, “ISBN”, and each record is a single book entry. 📖
Example: Student Records Table
Below is a simple example of a single‑table database that stores student information. The table has five fields and three records.
| Field (Column) | Record 1 | Record 2 | Record 3 |
|---|---|---|---|
| Student ID | S001 | S002 | S003 |
| Name | Alice | Bob | Charlie |
| Age | 15 | 16 | 15 |
| Grade | 10 | 10 | 9 |
| alice@example.com | bob@example.com | charlie@example.com |
How to Identify Fields and Records
- Look at the table header: The first row (inside
<thead>) lists the field names. These are the columns you will use to describe each record. - Count the rows: Each row inside
<tbody>after the header is a record. If there are $n$ rows, then there are $n$ records. - Match data to fields: For any given record, the data in each column corresponds to the field name above it. For example, the second column of the first row is the Student ID for the first record.
- Check data types: Fields usually have a specific data type (e.g., text, number, email). In our example,
Ageis a number, whileEmailis text.
Quick Quiz – Identify the Fields and Records
Given the following snippet, list the fields and how many records it contains:
| Field | Record 1 | Record 2 |
|---|---|---|
| Product ID | P001 | P002 |
| Name | Laptop | Smartphone |
| Price | $1200 | $800 |
Answer: Fields: Product ID, Name, Price. Records: 2. ??
Key Takeaways
- Fields are the column headers that describe the type of data.
- Records are the individual rows that contain the actual data.
- A single‑table database keeps all data in one place, making it easy to view and manage.
- Always check the header row to identify fields, then count the data rows to find the number of records.
Happy database exploring! 🚀
Revision
Log in to practice.