Computer Science · Ch 8 — Database Concepts
Relational Data Model
Relational Data Model
The Relational Data Model: The Foundation of Modern Databases
A data model is the blueprint for a database — it defines how data is structured, how it relates to other data, and what rules (constraints) govern it. Among the many types of data models (object-oriented, entity-relationship, document, hierarchical), the relational data model is the most widely used. This entire chapter focuses on databases built on this model.
In the relational model, data is stored in tables, which are formally called relations. Each table can have multiple columns, and every column name within a table must be unique. A single row in a table represents a related set of values — for instance, one row in a GUARDIAN table holds a specific guardian's ID, name, address, and phone number together. A table, therefore, is a collection of such relationships (rows).
Relations in a database are not independent of each other. They are linked through shared attributes. For example, the ATTENDANCE table has a RollNumber attribute that connects each attendance record to the correct student in the STUDENT table. Similarly, the STUDENT table includes a GUID (Guardian ID) to pull up a guardian's details. Without these linking attributes, the database cannot maintain a correct state or retrieve valid information.
The Student Attendance Database: A Concrete Example
The textbook builds a complete example around a Student Attendance database, which consists of three related relations:
Relation Schemas of the Student Attendance Database
Each row (tuple) in a relation corresponds to data about a real-world entity — a specific student, a specific guardian, or a specific attendance record. In the GUARDIAN relation, for instance, every row holds facts about one guardian, and each column name tells you what the data in that column means. A database designed on these principles is called a relational database.
Key Terminologies of the Relational Data Model
Using the populated GUARDIAN relation (which has 4 columns and 5 rows of data) as a reference, here are the five essential terms:
-
Attribute: An attribute is a characteristic or parameter for which data is stored. Simply put, the columns of a relation are its attributes (also called fields). For the GUARDIAN relation, the attributes are
GUID,GName,GPhone, andGAddress. -
Tuple: Each row of data in a relation is called a tuple. In a table with
ncolumns, a tuple represents a relationship between thosenrelated values. …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your NCERT textbook's own diagram.
This shows the same three files from Figure 8.1, now viewed as relations — the formal database term for these table-like structures — with their empty column structures linked together.
The connecting line from GUARDIAN's GUID to STUDENT's GUID shows that a student's GUID links back to their guardian's record. The connecting line from STUDENT's RollNumber to ATTENDANCE's RollNumber shows that an attendance record links back to a specific student. These shared fields are what make it possible to combine information across all three relations — for example, to find a student's guardian's phone number starting only from an attendance record. …
Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your NCERT textbook's own diagram.
This is the GUARDIAN relation with real data filled in — five actual guardian records.
The callouts point out the vocabulary used to describe a relation: the header row (GUID, GName, GPhone, GAddress) defines the relation's attributes — 4 of them, so the relation's Degree is 4. Each data row below is one record/tuple — 5 of them here, so the relation's Cardinality is 5. …
| Relation Scheme | Description of attributes |
|---|---|
| STUDENT(RollNumber, SName, SDateofBirth, GUID) | RollNumber: unique id of the student SName: name of the student SDateofBirth: date of birth of the student GUID: unique id of the guardian of the student |
| ATTENDANCE (AttendanceDate, RollNumber, AttendanceStatus) | AttendanceDate: date on which attendance is taken RollNumber: roll number of the student AttendanceStatus: whether present (P) or absent(A) Note that combination of AttendanceDate and RollNumber will be unique in each record of the table |