Check Key Uniqueness Before Joining
Find duplicate identifiers and stop an ambiguous lookup.
Supplied materials
- Paper and pencil; an adult may read aloud. No device, account or purchase is needed.
Learn the idea
A lookup expects a key to identify one row. If a supposedly unique key appears twice with different values, a key match alone no longer chooses one record. The correct response depends on the data contract; here the contract requires every object_id to be unique and any duplicate to be rejected before joining.
Supplied objects table: O1 = map; O2 = compass; O2 = globe. A request references object_id O2. Both compass and globe match, so choosing the first row would hide the violation. Trace a validation algorithm: set seen to empty; for each key, if it is already in seen report duplicate, otherwise add it.
- Write the supplied three rows with their identifiers.
- Track seen after each key: {O1}, then {O1,O2}.
- On the last O2, report duplicate and stop the lookup under this contract.
- Repair with a verified invented identifier O3 for globe, then retest uniqueness and the O2 request.
See the method in action
Validation sees O1 new, O2 new, O2 repeated: duplicate O2. After the exercise repair to O3 = globe, seen is {O1,O2,O3}; request O2 unambiguously returns compass. A real data repair would require confirming the intended identifiers, not guessing.
Check your reasoning
Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.
See the answer and explanation
K1
K1 occurs twice. The uniqueness requirement concerns the key field; other non-key values can legitimately repeat.
Take it further
Change the repaired table’s globe key back to O1. Expected validation error: duplicate O1. The specific conflicting key changes, but validation still rejects the table.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
Check the subject sources
These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.