IFB105 — Open-Book Exam Cheat Sheets
Print this. Tab the sections. Designed for fast lookup in the 2-hour open-book exam.
1. ELEMENTARY FACTS & ORM
Elementary fact = atomic, true, no conditions, can't be split.
- ✗ "has Phone AND Email" (splittable) ✗ "is NOT a patient" (negation) ✗ "...so..." (condition)
- Format: The Entity with RefMode "value" [role] the Entity with RefMode "value".
Object types:
- Value type = self-identifying, NO reference mode (numbers, strings like "ABC123", Grade, Mark).
- Entity type = needs a definite description + reference mode (Student(.StudentID)).
Count objects = count distinct entities + value types (ignore the literal values).
- "Emp has Job Title" = 2 · "Student got Mark on Exam" = 3 · "Device is unallocated" = 1 · "Device allocated to Emp" = 2.
Arity: Unary (1 role, e.g. "Room is vacant") · Binary (2) · Ternary (3).
Associations: 1:1 (each↔one) · 1:n (one prof, many classes) · m:n (students↔subjects).
Diagram notation: solid box = entity; dashed box = value type; box(es) between = roles; bar over role = uniqueness; ● dot = mandatory.
- UC on 1 role = many-to-one · UC spanning both = m:n · UC on each separately = 1:1.
CSDP 7 steps (only 1–5 examined):
- Examples → elementary facts.
- Draw fact types + population check.
- Combine entity types; note derivations (don't store derived values).
- Add uniqueness constraints; check arity. n–1 rule: UC spans ≥ (n–1) roles.
- Add mandatory roles; check logical derivations. 6–7. (value/set/subtype/other — NOT examined).
Constraint violations (Executes vs XX Violated):
- Duplicate in single-role UC → uniqueness violated.
- Object plays a role without its mandatory role → mandatory violated.
- Duplicate combination in spanning UC → that UC violated.
2. KEYS
| Key | Properties |
|---|---|
| Super key | Unique |
| Candidate key | Unique + Irreducible (can't drop a column) |
| Primary key | Unique + Irreducible + No nulls |
| Alternate key | A candidate key not used as PK |
| Foreign key | Child column matching parent PK → referential integrity |
- Every candidate key IS a super key; NOT every super key is a candidate key.
- "Every super key is a candidate key" = FALSE.
- "Primary key references parent from child" = FALSE (that's the foreign key).
- Find candidate key: the column-set that's always unique AND can't be reduced.
3. RELATIONAL MAPPING (RMAP)
Syntax: Table {col1, col2, [optional], col3}
- underline = uniqueness · double underline = PK ·
[brackets]= optional/nullable · dotted arrow = FK (child → parent PK).
Apply Rules 1→4 in strict order:
- Rule 1 — m:n & ternary → own table, PK = combo of both IDs.
link {idA, idB}. - Rule 2 — 1:n / unary → group attributes onto the entity's table, keyed on its ID.
- Rule 3 — nested (objectified) fact → own table, PK = the nested fact's key + its attributes. (No nesting → doesn't apply.)
- Rule 4 — 1:1 → put fact in ONE table:
- 4.1 only one side has another functional role → group on that side.
- 4.2 both functional, only one mandatory → group on the mandatory side.
- 4.3 neither has another functional role → separate table.
- 4.4 both functional & (both/neither mandatory) → your discretion, minimise NULLs.
- Then add FK arrows.
- Derived values are NOT stored (e.g. maintenanceDate = installDate + 1yr → omit).
4. NORMALISATION
FD: X → Y = each X has at most one Y. X = determinant, Y = determinee. A key determines all non-key attributes.
- Partial dependency = non-key depends on part of a composite key → breaks 2NF.
- Transitive dependency = non-key depends on another non-key (key→A→B) → breaks 3NF.
| Form | Requirement |
|---|---|
| 0NF | Not atomic / no key / repeating groups |
| 1NF | Atomic values + a PK + one type per column |
| 2NF | 1NF + no partial dependencies |
| 3NF | 2NF + non-key attrs mutually independent (no transitive) |
Find highest NF: atomic+key? (else 0NF) → partial dep? (stuck 1NF) → non-key→non-key? (stuck 2NF) → else 3NF.
- Single-column PK → can't have partial dependency → 1NF ⇒ automatically 2NF.
Normalise to 3NF: 1) ensure atomic+key; 2) pull part-key attributes into own tables (2NF); 3) pull non-key→non-key pairs into own tables keyed on determinant (3NF); 4) write RMap + add FKs.
5. SQL — DDL
CREATE TABLE T (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
cat ENUM('A','B','C'),
parentID INT,
FOREIGN KEY (parentID) REFERENCES Parent(id)
);
ALTER TABLE T ADD col VARCHAR(20); -- structure
ALTER TABLE T MODIFY col INT;
ALTER TABLE T DROP COLUMN col;
DROP TABLE T; -- whole table
CREATE VIEW V AS SELECT a,b FROM T; -- security: hide columns
- Constraints:
PRIMARY KEY, FOREIGN KEY ... REFERENCES, NOT NULL, UNIQUE, CHECK, DEFAULT, AUTO_INCREMENT. - Entity integrity = PK not null · Referential integrity = FK matches a parent PK.
6. SQL — DML
INSERT INTO T VALUES (...);
INSERT INTO T (c1,c2) VALUES (v1,v2);
UPDATE T SET col = val WHERE cond; -- ONLY correct update form
DELETE FROM T WHERE cond;
INSERT fails when: duplicate PK · duplicate UNIQUE value (e.g. email) · FK points to a missing parent row. Else Executes.
7. SQL — SELECT (order: FROM→WHERE→GROUP BY→HAVING→SELECT→ORDER BY)
SELECT col, COUNT(*) AS n
FROM t
WHERE cond -- filters rows
GROUP BY col
HAVING COUNT(*) > 2 -- filters groups
ORDER BY n DESC; -- ASC default
- WHERE = rows, HAVING = groups.
- NULL: use
IS NULL/IS NOT NULL(never= NULL). - Aggregates:
COUNT, SUM, AVG, MIN, MAX.COUNT(*)+ GROUP BY = times each value appears.
Pattern matching: LIKE 'A%' (starts A) · '%n' (ends n) · '_a%' (2nd char a). %=any chars, _=one char.
Set ops: UNION (either, no dupes) · UNION ALL (keep dupes) · INTERSECT (both) · EXCEPT (first not second).
Subquery (inside-out):
SELECT firstName,lastName,email FROM Customer
WHERE customerID IN (
SELECT customerID FROM Orders
GROUP BY customerID HAVING SUM(totalPrice) > 100);
Joins:
- INNER = matches in both · LEFT = all left + matched right (NULLs) · RIGHT = all right · FULL = all both.
SELECT c.name, o.total FROM Customer c
LEFT JOIN Orders o ON c.id = o.customerID;
Reading results: evaluate inner queries first, track sets, write output exactly (capitalisation/punctuation), no column names if not asked.
8. SQL — DCL
GRANT SELECT, INSERT ON t TO user; · REVOKE ... FROM user;
9. SECURITY & ADMIN
- View = stored query / virtual table → hide sensitive columns/rows (security).
- Backup/recovery: logical/hot (online,
mysqldump) vs physical/cold (offline). Recovery restores from backup. - Access control: DAC (owner grants — GRANT/REVOKE) · RBAC (roles) · MAC (labels). Least privilege.
- Role = bundle of privileges assigned to users.
- Transaction ACID: Atomicity (all/none) · Consistency (valid→valid) · Isolation (no interference) · Durability (survives crash).
START TRANSACTION; ... COMMIT;/ROLLBACK;.
10. ETHICS & INDIGENOUS DATA
Ethics = right conduct; fills the gap laws leave; subjective/cultural. Laws: NDB scheme (AU, fines ≤ ~$2.1M) · GDPR (≤ 4% global turnover/€20M; "right to be forgotten") · Privacy Act 1988. Data breach = unauthorised copy/view/steal/use of protected data.
CARE principles (assess: yes/no + justify):
- C — Collective Benefit: use supports community outcomes.
- A — Authority to Control: community controls collection/access/sharing.
- R — Responsibility: maintain respectful relationships, respect protocols, avoid harm.
- E — Ethics: honour Indigenous worldviews/rights; consult on benefits/harms/future use.
- CARE complements FAIR (Findable, Accessible, Interoperable, Reusable).
IDS = right to govern data about Indigenous communities. IDG = right to decide what/how/why data is collected/used. BADDR (bad) data: Blaming, Aggregated, Decontextualised, Deficit-focused, Restricted. Needs: narrative, disaggregated, contextualised, Indigenous-priority, available.
AIBS exam pattern: C ✓ (health benefit); A ✗ (no community access/say); R ✗ (relationships not maintained); E ✗ (no consultation on future use).
11. RELATIONAL MODEL / ARCHITECTURE
- Table=relation, row=tuple/record, column=attribute/field. Rows unique, cells atomic.
- Redundancy → update/insert/delete anomalies. Fix with multiple tables + normalisation.
- 3-level architecture: External (views) → Conceptual (logical, ORM) → Internal (physical).
- Logical data independence (conceptual change ↛ views) · Physical data independence (storage change ↛ conceptual).