Question 1
15 marks
CrossCountryXL transport company relational schema, queries, and data recovery
- Databases
(a)
3 marks
- Identify the three core entities in the logistics domain: `CrossCountryXL` (or Transport Company), `Retailer`, and `Supplier`.
- Determine the relationship cardinalities: `CrossCountryXL` delivers items from multiple `Retailer` entities (), and each `Retailer` deals with multiple `Supplier` entities ( or as suppliers may supply multiple retailers).
- Construct the Entity-Relationship Diagram (ERD) with descriptive action verbs:
- `CrossCountryXL` (1) ----< [delivers for] >---- (N) `Retailer` (1/M) ----< [sourced from / supplies] >---- (N) `Supplier`
Mentor tip
Always label both the entity boxes and the relationship diamonds/lines with clear verbs and explicit cardinality notations (1:N or M:N).
(b)
2 marks
- In the `SUPPLY` relation, `Supplier_ID` serves as the underlined primary key, which uniquely identifies each tuple in the table.
- Because primary key values must be strictly unique and cannot contain duplicates, changing `34567890` to `54959299` (which already exists in row 3 of `SUPPLY`) creates a duplicate key violation and breaks entity/referential integrity.
Mentor tip
Focus on the uniqueness requirement of a primary key: no two records in the same relation can share an identical primary key value.
(c)(i)
1 mark
- Filter the `ITEM` table for rows where `Quantity > 150` and project the `Item_Name` column:
- `Oranges`, `Bags`, `Wallets`, `Tomatoes` (corresponding to quantities 190, 180, 201, and 167).
Mentor tip
Check every row carefully against the strict inequality (> 150) and output only the requested column (`Item_Name`).
(c)(ii)
1 mark
- Filter the `SUPPLY` table for rows where `Nature_Of_Goods = 'P'` and project the `Supplier_ID` column:
- `34567890`, `54959299`, `45908919`.
Mentor tip
Ensure all three matching identifier strings are listed accurately.
(d)
4 marks
- Step 1 (Table selection): Select both the `SUPPLIER` and `SUPPLY` tables.
- Step 2 (Join condition): Link the two relations on their common key: `SUPPLIER.Supplier_ID = SUPPLY.Supplier_ID`.
- Step 3 (Filter condition): Apply the selection criterion `SUPPLY.Nature_Of_Goods = 'P'` to isolate perishable goods.
- Step 4 (Projection): Project and output the `SUPPLIER.Name` field from the joined, filtered records.
Mentor tip
You can express query steps either as structured algorithmic bullet points or as an equivalent SQL `SELECT ... FROM ... JOIN ... WHERE` statement.
(e)
4 marks
- Measure 1 — Write-Ahead Transaction Logging: Record all database modifications and transaction details in a sequential log file on fail-safe external storage before committing changes to disk, allowing the system to replay or undo actions after a crash.
- Measure 2 — Regular Off-site Backups: Schedule automated periodic full and incremental backups of the database to redundant remote or cloud storage so the supplier tables can be reconstituted to a known consistent state if hardware fails.
Mentor tip
For each recovery measure, state both the mechanism (e.g., transaction logs, regular backups) and how it restores lost data.

