Loading...
A database can support several ways of finding the same records. Choose keys and indexes from query needs, and preserve meaning when data cross a system boundary.
What you'll be able to do
A primary key uniquely identifies each row. A foreign key links a row to a valid referenced key. A secondary key is an additional attribute or combination used for access or searching; it need not be unique. A student surname can help find records even though several students may share it.
Do not infer uniqueness from a small sample. If a query asks for every student in a house, the house field is useful for selection but cannot identify one student reliably. The schema’s primary-key constraint and a chosen search field solve different problems. A secondary key in this syllabus sense should not be confused with a second primary key for the same table.
An index maintains an additional structure that helps locate matching rows without scanning every row in many suitable queries. A sorted/tree-based index on surname can support surname searches; an implementation might also use other structures. The database still needs to return the actual matching rows and obey the query conditions.
Indexes consume storage and must be updated when indexed data change. They can accelerate frequent selective reads while making inserts, deletes or updates more expensive. A query returning nearly every row may gain little from a particular index. Explain the workload: indexing every field automatically is not a sound universal rule. The database optimiser may choose a scan when that is cheaper.
Capture methods include forms, sensors, optical character recognition and optical mark recognition. Select according to the source: OCR recognises characters, while OMR detects marks in expected positions. Validation checks rules such as range or presence; verification can compare a transcription with its source. Neither alone proves that a plausible measurement is true.
For exchange, CSV represents tabular records with an agreed delimiter, quoting and field order; JSON represents structured values including arrays and objects. A text field containing a comma needs correct CSV quoting rather than naive splitting. Agree identifiers, date formats, units, encoding and missing-value conventions. Test importing a representative sample and reconcile counts before treating an exchange as successful.
| Requirement | Possible method | Reason to check |
|---|---|---|
| Search non-unique surnames | Secondary search key with suitable index | Several rows may match |
| Capture marked responses | OMR | Marks must fit the expected layout |
| Capture printed identifiers | OCR | Recognition errors need handling |
| Exchange flat records | CSV | Delimiters and quoting must be agreed |
| Exchange nested structure | JSON | Schema, value types and missing fields matter |
Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.
Common mistakes to avoid
Key takeaways
Test yourself
Answer a few questions, then review anything you missed.
Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.