Storing data in plain files works until the data grows — then you hit duplication, errors and chaos. A database organises data so it can be stored, searched and updated reliably. The model used almost everywhere is the relational model: data in neat tables. This chapter gives you the vocabulary the rest of the unit depends on.
1Why a database, not just files?
Imagine a school keeping student records in separate files for each teacher. Problems pile up:
- Data redundancy — the same data (a student's address) stored in many places.
- Data inconsistency — those copies disagree when one is updated and others aren't.
- Difficult access & sharing — hard to search across files or let many users work safely at once.
- Poor security & integrity — no central control over who sees or changes what.
A Database Management System (DBMS) solves these by storing data centrally with controlled access, reducing redundancy, enforcing consistency, and supporting backup and security.
- Flat files cause redundancy (duplicated data), inconsistency (copies disagree), and poor sharing/security.
- A DBMS stores data centrally with controlled access.
- Benefits: less redundancy, enforced consistency, easier sharing, better security and backup.
2The relational model
In the relational model, data lives in tables. Each term has a precise name you must know:
| Term | Means |
|---|---|
| Relation | A table |
| Tuple | A row (one record) |
| Attribute | A column (a field) |
| Domain | The set of allowed values for an attribute (e.g. marks 0–100) |
| Degree | The number of attributes (columns) |
| Cardinality | The number of tuples (rows) |
- Relation = table, Tuple = row (record), Attribute = column (field).
- Domain = the allowed set of values for an attribute.
- Degree = number of columns (attributes); Cardinality = number of rows (tuples).
3Keys
A key uniquely identifies rows or links tables. The four to know:
- Candidate Key — any attribute (or set) that can uniquely identify each row. A table may have several candidates (e.g. roll number, admission number).
- Primary Key — the one candidate key chosen to be the main unique identifier. It cannot be NULL or duplicated.
- Alternate Key — the candidate keys not chosen as the primary key.
- Foreign Key — an attribute in one table that refers to the primary key of another table, linking them together.
roll column that points to the roll primary key in the STUDENT table, that roll in MARKS is a foreign key — it ties each marks record to a real student.- Candidate key = any attribute(s) that can uniquely identify a row; a table can have several.
- Primary key = the chosen candidate key (unique, not NULL); alternate keys = the other candidates.
- Foreign key = an attribute referring to another table's primary key — it links the two tables.
★ Practical: model a table
For a STUDENT table with columns roll, name, class, marks and 30 students:
- State its degree and its cardinality.
- Which attribute is the best primary key, and why?
- Name the relational term for a single student's record.
- If a separate MARKS table refers to roll, what kind of key is roll in MARKS?
Ready for the chapter test?
Answer 5 questions. Score 60% or more to mark this chapter complete.
Start the test →💡 Log in to save your progress and earn the certificate.