Circle of Learning Logo CIRCLE OF LEARNING Excellence in Education
CBSE Class 12 · Computer Science Chapter 8 Session 2026-27

Relational Database Concepts & Data Models Formulas & Cheat Sheet

Complete chapter-wise reference, step-by-step formula explanations, structured table, and board exam trap warnings.

Core Concepts & Theoretical Foundations

  • Relational Model (E.F. Codd 1970): Organizes data into two-dimensional tables called Relations composed of rows (Tuples) and columns (Attributes).
  • Core Terminology: Relation (Table), Attribute (Column / Field), Tuple (Row / Record), Domain (pool of legal atomic values for an attribute), Degree (number of attributes), Cardinality (number of tuples).
  • Relational Keys: 1) Candidate Key (minimal superkey capable of uniquely identifying a tuple), 2) Primary Key (chosen candidate key; cannot contain NULL), 3) Alternate Key (candidate keys not selected as primary key), 4) Foreign Key (attribute in a table whose values reference the primary key of another table).
  • Integrity Constraints: Entity Integrity (primary key cannot be NULL) and Referential Integrity (foreign key value must either match an existing primary key value in parent table or be NULL).

Chapter Formulas & Equations (10 entries)

# Topic / Formula Name Mathematical Form & Equation Conditions, Meaning & Board Tips
1 Degree of a Relation Formula
Degree=∣Attributes∣\text{Degree} = |\text{Attributes}|

Does not change when rows are added or deleted.

2 Cardinality of a Relation Formula
Cardinality=∣Tuples∣\text{Cardinality} = |\text{Tuples}|

Increases with INSERT and decreases with DELETE.

3 Cartesian Product Degree & Cardinality Identities
Degree(R1×R2)=D1+D2;Cardinality(R1×R2)=C1×C2\text{Degree}(R_1 \times R_2) = D_1 + D_2; \quad \text{Cardinality}(R_1 \times R_2) = C_1 \times C_2

Cross product pairs every row of first table with every row of second table.

4 Candidate Key Minimal Superkey Property
K is Candidate Key  ⟺  K→R∧(∀K′⊂K,K′↛R)K \text{ is Candidate Key} \iff K \to R \land (\forall K' \subset K, K' \not\to R)

Ensures uniqueness without redundant attributes.

5 Alternate Keys Formula
Alternate Keys=Candidate Keys∖{Primary Key}\text{Alternate Keys} = \text{Candidate Keys} \setminus \{\text{Primary Key}\}

Unselected candidate keys that remain viable unique identifiers.

6 Entity Integrity Rule
∀t∈R,t[PK]≠NULL\forall t \in R, \quad t[\text{PK}] \neq \text{NULL}

Ensures every row has a distinct identifiable anchor.

7 Referential Integrity Rule
∀t1∈R1,t1[FK]∈ΠPK(R2)∨t1[FK]=NULL\forall t_1 \in R_1, \quad t_1[\text{FK}] \in \Pi_{\text{PK}}(R_2) \lor t_1[\text{FK}] = \text{NULL}

Prevents orphaned child records referencing non-existent parent rows.

8 Atomic Domain Property
Domain(A)  ⟹  Atomic scalar values only\text{Domain}(A) \implies \text{Atomic scalar values only}

Disallows multi-valued lists or arrays inside a single cell.

9 Database Schema vs Database Instance
Instancet=Data at time t\text{Instance}_t = \text{Data at time } t

Schema changes rarely; instances change with every DML operation.

10 Equi-Join Output Cardinality Bound
0≤∣R1⋈R2∣≤C1×C20 \le |R_1 \bowtie R_2| \le C_1 \times C_2

If join condition is on a foreign key referencing primary key, output cardinality <= child cardinality C1.

Step-by-Step Worked Board Exam Examples

Example 1: Table `STUDENT` has 5 columns and 40 rows. Table `ENROLLMENT` has 3 columns and 100 rows. (i) What is the degree and cardinality of `STUDENT`? (ii) If a Cartesian Product (`STUDENT × ENROLLMENT`) is executed, what will be the degree and cardinality of the resulting table?

1. For STUDENT: Degree = Columns = 5; Cardinality = Rows = 40.

2. For ENROLLMENT: Degree = Columns = 3; Cardinality = Rows = 100.

3. Cartesian Product Degree = Degree(STUDENT) + Degree(ENROLLMENT) = 5 + 3 = 8.

4. Cartesian Product Cardinality = Cardinality(STUDENT) × Cardinality(ENROLLMENT) = 40 × 100 = 4,000.

Ans: (i) STUDENT: Degree = 5, Cardinality = 40; (ii) Cartesian Product: Degree = 8, Cardinality = 4,000.

Example 2: A table `EMPLOYEE` has attributes: `EmpID`, `AadhaarNo`, `Email`, `Name`, `Salary`. Both `EmpID` and `AadhaarNo` are unique and non-null for all employees. If `EmpID` is chosen as the Primary Key, identify: (i) Candidate Keys, (ii) Alternate Key.

1. Unique candidate identifiers: `EmpID` and `AadhaarNo` (and `Email` if unique).

2. Candidate Keys = {EmpID, AadhaarNo}.

3. Chosen Primary Key = EmpID.

4. Alternate Key = Candidate Keys minus Primary Key = {AadhaarNo}.

Ans: (i) Candidate Keys: {EmpID, AadhaarNo}; (ii) Alternate Key: {AadhaarNo}.

Common Mistakes to Avoid in Exam

  • Confusing Degree with Cardinality: Degree is the number of COLUMNS/ATTRIBUTES; Cardinality is the number of ROWS/TUPLES.
  • Adding cardinalities in Cartesian Product: Degree is ADDED (D1 + D2); Cardinality is MULTIPLIED (C1 × C2).
  • Allowing NULL in a Primary Key: A Primary Key can NEVER contain NULL values (Entity Integrity); a Foreign Key CAN contain NULL unless constrained by NOT NULL.
  • Deleting a parent record while child records exist: Violates Referential Integrity; parent record cannot be deleted unless `ON DELETE CASCADE` is configured.

Target Practice Questions

Q1. If a table with 6 columns and 20 rows has 5 rows deleted and 2 columns added, what is its new degree and cardinality?

Correct Answer: New Degree = 6 + 2 = 8 columns; New Cardinality = 20 - 5 = 15 rows.

Q2. Can a table have multiple Primary Keys?

Correct Answer: No, a table can have only ONE Primary Key (though that primary key can consist of multiple columns, known as a Composite Primary Key).

Q3. What is the degree of a relation with no attributes?

Correct Answer: Degree is 0 (an empty schema).

Frequently Asked Questions

Q. What is the difference between a Candidate Key and a Primary Key?

A Candidate Key is any column or set of columns that can uniquely identify a tuple in a table without redundancy. The database designer selects one of these candidate keys to become the Primary Key of the table.

Q. What is an Alternate Key?

An Alternate Key is a candidate key that was not chosen as the primary key. It remains an available unique identifier.

Q. What is a Foreign Key and what integrity rule does it enforce?

A Foreign Key is an attribute in one table whose values reference the Primary Key of another table (or the same table). It enforces Referential Integrity, guaranteeing that relationships between tables remain valid.

Q. What does the term 'Domain' mean in relational databases?

A Domain is the pool or set of all permissible atomic values from which an attribute can draw its values (e.g. Domain of `Age` might be integers between 1 and 120).

Q. What is Data Redundancy and how does a DBMS reduce it?

Data redundancy refers to the unnecessary duplication of the same data across multiple files. A DBMS minimizes redundancy through normalization and centralized relational storage.

← View All 11 Chapters in Class 12 Computer Science Formula Book