The Record
The fundamental unit of a relational database is the record.
To understand records, we first need to understand entities. An entity is any real-world object, person, or concept that we want to store information about. In a library database, for example, each individual book is an entity.
- In a database, every unique entity is represented by a corresponding record.
- The specific details or characteristics of an entity are stored in fields. For a book entity, the fields might include its title, author, and genre.
- Records that describe the same type of entity (and therefore have the same types of fields) are grouped together into tables. All the individual book records together form the
Bookstable. - Visually, each record is a row, and each field is a column.
Example: The Books Table
Let's look at the Books table from our library example.
| BookID | Title | AuthorID | Genre | PublishedYear |
|---|---|---|---|---|
| 1 | The Hobbit | 101 | Fantasy | 1937 |
| 2 | 1984 | 102 | Dystopian | 1949 |
| 3 | The Fellowship of the Ring | 101 | Fantasy | 1954 |
| 4 | Dune | 103 | Sci-Fi | 1965 |
In this table:
- There are four records, one for each book.
- The first record (for "The Hobbit") is the first row of data.
- The table has five fields:
BookID,Title,AuthorID,Genre, andPublishedYear.