Grade 10 · lesson 1 of 4

Use a Primary Key to Identify a Row

Check uniqueness of the declared key rather than every field in a row.

About 22 minutes, plus any extended practice

Download the grade pack

Supplied materials

  • Paper and pencil; answers may also be spoken or typed.
  • All cases, labels, numbers and rules are supplied on this page. No real account, private information or purchase is needed.

Learn the idea

A primary key uniquely identifies rows under a database’s declared constraints. A display name is often not unique, so it may be unsuitable as the key. The model supplies a stable item ID and explicitly enforces uniqueness. Repeated values in other fields do not necessarily violate a key.

Check uniqueness of the declared key rather than every field in a row. Two items can share a display name while having different valid identifiers.

Use this supplied case: IDsA and B appear once each. Enforced primary key is item_id. Classify the case. The task is to connect the given information to the computing idea. Write a short evidence trail so another learner can reproduce your choice. The simplified case describes the stated model, not every real system.

  1. Represent the supplied worked case with a labeled drawing, table or short trace.
  2. Check uniqueness of the declared key rather than every field in a row.
  3. Explain why the worked answer fits and why one alternative does not.
  4. Try the new check and practice cases; revisit the stated rule if your evidence does not match.
Worked example

See the method in action

Rows item_id=J/name=Map and item_id=K/name=Map have J≠K, with both required IDs present, so they satisfy the declared primary-key rule. Their repeated non-key name is allowed because only item_id is unique in this contract. Add another item_id=J row: now J repeats and the key rule fails. Removing a required item_id would instead create a missing-key failure. Apply the actual declared constraint rather than demanding that every displayed value be unique.

Your turn

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.

Helpful tips
  • Check uniqueness of the declared key rather than every field in a row.
  • Two items can share a display name while having different valid identifiers.
Rows item_id=A and item_id=A are supplied. The required primary key is item_id. Which constraint outcome follows?

Feedback appears here after you check. This is practice, not a graded school assessment.

See the answer and explanation

Reject: the primary key A is repeated

Both rows have A as the declared key, violating uniqueness. They are not distinct keys and no missing-key premise is supplied.

Take it further

Rows ID P/name Box and ID Q/name Box satisfy unique IDs; another ID P row violates the enforced primary-key rule. Display-name equality alone is not a key defect.

Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback. It does not include choices from the separate More practice section. Download that section separately.

More practice: try new cases

Choose an answer for each problem. Explain your method on paper, then use the feedback to decide what to revisit.

More practice: try new cases
1. One supplied row has no item_id. The primary key item_id is required. Which constraint outcome follows?
Need a hint?
  • Use the explicit input, condition and question aspect.
  • Reject a choice that adds an unsupported condition or answers a different question.
2. Rows item_id=C/name=Box and item_id=D/name=Box are supplied. Only item_id is required unique; name is a non-key field. What follows about the repeated name?
Need a hint?
  • Use the explicit input, condition and question aspect.
  • Reject a choice that adds an unsupported condition or answers a different question.
3. Rows item_id=E and item_id=F are supplied, each present once. The primary key item_id is required unique. Which constraint outcome follows?
Need a hint?
  • Use the explicit input, condition and question aspect.
  • Reject a choice that adds an unsupported condition or answers a different question.

Your choices are temporary. Feedback appears after you check all the answers.

Nothing here is saved to an account or sent to a teacher. Keep your own notes or download them before leaving. The score describes these questions; it does not certify subject mastery.

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.