

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The definitions, normal forms and transaction properties that exam questions test Computer Science | Undergraduate (Level 5) | December 2026
WHAT IS INSIDE
A relation is a set of tuples over a schema of named, typed attributes; because it is a set, duplicate tuples are impossible and tuple order carries no meaning. A superkey uniquely identifies a tuple, a candidate key is a minimal superkey, and the primary key is the candidate key chosen for identification. A foreign key references a candidate key in another relation and enforces referential integrity: its value must exist there or be null where permitted.
Integrity constraints are declared, not assumed: entity integrity forbids null primary keys, referential integrity forbids dangling references, and domain constraints restrict values to their type. The important exam distinction is between the schema (the stable structure) and the instance (the current data), because constraints are stated on the schema and evaluated on the instance. Relational design also explains why a table without a declared key is not a relation in the formal sense, however it looks in a spreadsheet.
Relational algebra is the formal basis: selection filters rows, projection chooses columns, cartesian product pairs rows, join pairs rows matching on a condition, and set operations combine compatible relations. SQL adds duplicate retention, ordering and aggregation, so a SQL query is not identical to an algebraic expression until duplicates are removed. Exam questions typically ask you to translate between the two; translate projection last, because the algebra collapses duplicates on projection while SQL does not without DISTINCT.
The clauses are evaluated in a fixed logical order: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. That order explains why an alias defined in SELECT cannot be used in WHERE, and why filtering an aggregate needs HAVING rather than WHERE. Outer joins preserve unmatched rows with nulls, and the classic error is turning an outer join back into an inner one by testing a column of the optional side in WHERE instead of in the join condition.
Databases: Relational Model, SQL, Normalisation and Transactions
A functional dependency X determines Y where every pair of tuples agreeing on X agrees on Y. Armstrong's axioms - reflexivity, augmentation and transitivity - derive the closure, and a minimal cover removes redundant attributes and redundant dependencies. Normalisation removes redundancy that causes update anomalies: insertion, deletion and modification anomalies all follow from storing one fact in many places, and each is examinable by example.
The forms build on each other. 1NF requires atomic values and no repeating groups. 2NF removes partial dependencies on part of a composite key. 3NF removes transitive dependencies, so every non-key attribute depends on the key and nothing else. BCNF requires every determinant to be a candidate key, which is stricter than 3NF when a relation has overlapping candidate keys. Denormalisation is a deliberate performance decision, and the correct exam answer names the redundancy reintroduced and the anomaly accepted in exchange.
A transaction is a unit of work satisfying ACID : atomicity (all or nothing), consistency (constraints hold before and after), isolation (concurrent execution behaves as if serial), and durability (committed work survives failure). The isolation levels are defined by the anomalies they permit: read uncommitted allows dirty reads, read committed prevents them, repeatable read prevents non-repeatable reads, and serialisable prevents phantoms as well. Every step down costs concurrency, which is the trade-off a question about banking throughput is really asking about.
Concurrency control uses two-phase locking (growing then shrinking phase) or timestamp ordering or multiversion schemes; a deadlock is a cycle in the wait-for graph, prevented by ordering resource acquisition or resolved by aborting a victim. Indexes - B+ trees for range queries, hash indexes for equality, and composite indexes where the leftmost prefix rule decides usability - trade write cost and storage for read speed. A query plan that ignores an index is usually caused by a function applied to the indexed column or by a type mismatch.
State the dependency you are removing at each step, not just the form number: marks are given for the dependency, and the form follows from it.