Independent reviewer · not a CSC or DICT publicationSign in to practice

Study notes · Databases · DICT

Database Concepts

Expect relational concepts (keys, relationships, normalization), SQL reading and writing, and transaction properties. The 2023 DICT FAQ lists database manipulation among the hands-on areas, so practise writing SQL by hand.

2023 FAQ (copy)Scope: Relational model, keys, normalization, SQL, transactions.

§1 Keys and relationships

§2 Normal forms

FormRequirement
1NFAtomic values; no repeating groups
2NF1NF + no partial dependency on part of a composite key
3NF2NF + no transitive dependency (non-key → non-key)

§3 SQL you should be able to write

TaskStatement
CreateCREATE TABLE item (id INT PRIMARY KEY, name VARCHAR(80), qty INT);
InsertINSERT INTO item (id, name, qty) VALUES (1, 'Bond paper', 20);
ReadSELECT name, qty FROM item WHERE qty < 10 ORDER BY name;
UpdateUPDATE item SET qty = qty - 1 WHERE id = 1;
DeleteDELETE FROM item WHERE id = 1;
AggregateSELECT category, COUNT(*) FROM item GROUP BY category;

§4 ACID

! Common traps

  • Writing UPDATE or DELETE without WHERE.
  • Using WHERE to filter aggregates — use HAVING.