Proposed by Edgar F. Codd in 1970 at IBM, the relational model replaced earlier hierarchical (tree) and network (graph) database systems.
Earlier Systems (Hierarchical & Network): Required programmers to write procedural navigation code specifying how to traverse pointers through records. If physical storage changed, programs broke.
The Relational Model: Uses simple tabular data structures based on first-order predicate logic and set theory. Users specify what data they need declaratively, leaving navigation and optimization to the DBMS engine.
A set of attributes K ⊆ R such that for any two distinct tuples t1, t2 ∈ r(R), t1[K] != t2[K]. Example: For student(id, name, email, tot_cred), {id}, {id, name}, and {id, email, tot_cred} are all superkeys.
A superkey K that is minimal—meaning no proper subset of K is a superkey. If any attribute is removed from K, uniqueness is lost. Example: If both id and email are unique, then {id} is a candidate key and {email} is another candidate key. {id, email} is a superkey, but not a candidate key.
The candidate key chosen by the database architect as the principal means of identifying tuples within the relation. Rule: Primary key attributes can never accept NULL values (Entity Integrity Constraint).
Answer:
Yes to both. Any relation with n attributes has at least one superkey (the set of all attributes). If a table has two unique attributes (e.g., student_id and aadhaar_number), each is an independent candidate key. Any superset of either candidate key is a valid superkey.
Answer:
A referential integrity violation occurs. The DBMS will reject the INSERT or UPDATE operation with a foreign key constraint violation error.
Answer:
ON DELETE RESTRICT / NO ACTION: Rejects the deletion if child rows exist.
ON DELETE CASCADE: Automatically deletes all referencing child tuples.
ON DELETE SET NULL: Sets the foreign key columns in referencing tuples to NULL.
ON DELETE SET DEFAULT: Sets foreign key columns to their declared default values.