Database Management System · Unit 3
Relational Data Model
Exam-focused notes for Relational Data Model (Database Management System, BIT202): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.
Relational Data Model in short
The relational model stores all data in tables. It is the base of nearly every modern database such as MySQL, Oracle, and PostgreSQL. This chapter explains its terms and the rules that keep data correct.
What this unit covers
- Relational model definition
- Relations versus flat files
- Relation, instance, and schema
- Attributes and domains
- Primary keys and foreign keys
- Integrity constraints
- Referential integrity
Relation, instance, and schema
2080 · 5 marks
Define relation, instance and schema. Explain with example [5]
Relations versus flat files
2079 · 5 marks
What is Relational Data model? How Relation is different than Flat file? [5]
Primary keys and foreign keys
2078 · 5 marks
What is Primary key and Foreign Key? Why is this required in the DBMS? [5]
Integrity constraints
2078 · 5 marks
What is Integrity constraint? What are the three main categories of Integrity constraints. [5]
Show solved answerHide answer
Integrity Constraints
Definition
An Integrity Constraint is a rule or condition imposed on a database to ensure the accuracy, consistency, and validity of data stored in the database. Integrity constraints prevent invalid data from being entered into the database and maintain the correctness of data throughout all operations (insertion, deletion, and update).
Three Main Categories of Integrity Constraints
1. Domain Integrity Constraints
- These constraints specify that the value of each attribute must be an atomic value from its domain (data type).
- They restrict the type, format, and range of values that can be stored in a column.
- Example: An attribute
Agemust contain only positive integer values; aGenderattribute may only accept'M'or'F'.
2. Entity Integrity Constraints
- This constraint states that the primary key of a relation must be unique and not null.
- Every tuple (row) in a relation must be uniquely identifiable.
- No attribute that is part of the primary key can have a NULL value.
- Example: In a
Studenttable, theStudentID(primary key) must have a unique, non-null value for every student record.
3. Referential Integrity Constraints
- This constraint is defined between two relations and is used to maintain consistency among tuples.
- It states that a foreign key in one relation must either match a primary key value in the referenced relation, or be NULL.
- It ensures that references between tables remain valid.
- Example: In an
Enrollmenttable, theStudentID(foreign key) must correspond to an existingStudentIDin theStudenttable.
Summary Table
| Constraint | Applies To | Key Rule |
|---|---|---|
| Domain Integrity | Attribute values | Values must be within defined domain |
| Entity Integrity | Primary Key | Must be unique and not null |
| Referential Integrity | Foreign Key | Must match a primary key or be null |
0 · 5 marks
Define domain constraint and referential integrity constraint. [5]
Make Unit 3 stick
Practice BIT202 with flashcards & quizzes