Question 1
18 marks
Hospital staff relational schema, SQL inner joins, data types, and DBA privacy controls
- Databases
(a)(i)
1 mark
Primary key in `STAFF`: `StaffID`.
Mentor tip
Identify the unique identifier attribute for each employee in the STAFF relation.
(a)(ii)
1 mark
Foreign key in `STAFF`: `RoleID` (or `DepartmentID`).
Mentor tip
State either RoleID or DepartmentID, which link STAFF to ROLE and DEPARTMENT respectively.
(b)
2 marks
- `ROLE` to `STAFF`: One-to-many (1:M) relationship — a single role (such as nurse or radiologist) is held by many staff members, while each staff member holds only one role.
- `DEPARTMENT` to `STAFF`: One-to-many (1:M) relationship in the depicted schema (or many-to-many conceptually across hospital departments).
Mentor tip
Clearly specify the cardinality for both pairs of linked tables.
(c)
2 marks
- Data filtering and extraction: A query retrieves a customized subset of records and attributes from one or more tables that satisfy specified search criteria.
- Data manipulation and aggregation: Enables users to sort, group, summarize (via `COUNT`, `AVG`, `SUM`), or update stored records.
Mentor tip
Explain that queries filter/retrieve specific subsets of data based on user-defined conditions.
(d)
4 marks
- Step 1 - Project attributes: Select `STAFF.FirstName`, `STAFF.Surname`, and `ROLE.PayGrade`.
- Step 2 - Join relations: Perform an `INNER JOIN` between `STAFF` and `ROLE`.
- Step 3 - Specify join condition: Match foreign and primary keys using `ON STAFF.RoleID = ROLE.RoleID`.
- Step 4 - Filter rows: Apply the `WHERE` condition `STAFF.Surname = 'Waters' AND ROLE.PayGrade = 17`.
- SQL equivalent:
- SELECT STAFF.FirstName, STAFF.Surname, ROLE.PayGrade FROM STAFF INNER JOIN ROLE ON STAFF.RoleID = ROLE.RoleID WHERE STAFF.Surname = 'Waters' AND ROLE.PayGrade = 17;
Mentor tip
Include the projection columns, the table join on RoleID, and both filtering conditions.
(e)
2 marks
- Whole-number domain and compact storage: Pay grades are discrete whole numbers (e.g., 17), which require minimal memory when stored as binary integers.
- Sorting and numerical comparisons: Integer representation allows direct numerical ordering (`ORDER BY PayGrade`) and range comparisons (`> `, `<`).
Mentor tip
Highlight that pay grades are whole numbers and integers enable numerical sorting/comparisons with low storage overhead.
(f)
6 marks
- Method 1 - Role-Based Access Control (RBAC) and Database Views:
- - Mechanism: The DBA assigns granular access permissions and constructs restricted SQL views that expose only non-sensitive attributes.
- - Hospital application: A department manager can view staff names and schedules within their unit while being blocked from viewing confidential `PayGrade` or `DateOfBirth` columns.
- Method 2 - Column-level / At-rest Encryption:
- - Mechanism: Sensitive database fields are encrypted using cryptographic keys before being written to disk, converting plaintext into unreadable ciphertext.
- - Hospital application: Even if unauthorized personnel or attackers gain physical access to storage media, personal staff records remain indecipherable without the decryption key.
Mentor tip
Provide two distinct methods (e.g., access control/views and encryption), explaining the mechanism and a concrete hospital staff example for each.

