Match records with a shared key
Use identifiers rather than row position to combine two tables.
Supplied materials
- Fictional people table: P1 = Ari, P2 = Bea, P3 = Cal. Fictional loans table: L1 has person_id P2 and item “atlas”; L2 has person_id P1 and item “ruler.”
- The people table’s person_id values are unique. No real names or records are needed.
Learn the idea
A key identifies a record. A related table can store that key to indicate which record it refers to. Match values of person_id, not row numbers or a guess based on ordering.
Keeping an identifier stable allows names or display order to change without changing the relationship. A missing referenced key needs handling; silently assigning the nearest row would invent a relationship.
- Write the people and loans as two separate tables.
- For L1, find the people row whose key is P2.
- For L2, find the row whose key is P1.
- Reorder the people rows and confirm that the matches stay the same.
See the method in action
L1’s person_id is P2, so the atlas loan belongs to fictional Bea. L2 uses P1, so the ruler loan belongs to fictional Ari. The first loan does not match the first people row simply because both are first.
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
Bea, because L1 still references P2
The shared key remains P2, which still identifies Bea. Row order does not change the stored key or the relationship.
Take it further
Add L3 referencing P9, which is absent. State “unmatched reference” and propose checking the input or enforcing a foreign-key constraint, rather than guessing a person.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
Longer courses for learners ages 14+
These related courses have their own preparation and projects. They are not early-grade assignments.
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.