Unable to open this exercise
Common exam pitfall
Students often select non-unique fields as primary keys or mix up validation types.
A primary key uniquely identifies each record in a table. Its values must not be duplicated or missing. A person's name is usually unsuitable because different people can share a name. A unique MemberID is more dependable.
Worked example
Two records have Name="Alex Lee" but MemberID values 104 and 105. The keys are unique even though the names match. A key constraint prevents duplicate key values; it does not prove the two records describe different real people.
Validation checks whether input meets a rule, not whether it is true. A presence check can require a name, a range check can limit age, and a format check can check the layout of an identifier. A validly formatted wrong date may still pass.
Independent design
Choose a primary key for a school library's books when several copies share a title. Explain why a separate copy identifier is needed. Choose a validation rule for a publication year and explain one incorrect value that could still pass it.
This course's core database tasks use a single table. Multiple-table relationships and advanced key taxonomy are optional later study.
AI Socratic Tutor
Need guidance? Ask a question or use the hint below.
AI Socratic Tutor is an All-Access Benefit
Unlock step-by-step Socratic hints, algorithm trace table walkthroughs, and error diagnostics for every Cambridge exercise.
You're chatting with an AI tutor, not a person. AI can make mistakes, so double-check its answers.
Exam-Style Question: Select Primary Key and Validation Rule
A medical clinic database stores a Patients table with the following fields:
NationalID(a unique 10-digit citizen identifier)SurnameDateOfBirthBloodGroup(must be one of 'A', 'B', 'AB', 'O')
- The field that should be chosen as the primary key is: [Space 1]
- To ensure that
BloodGrouponly contains one of the four accepted blood types, the database should apply a [Space 2] check. - To ensure that
NationalIDcontains exactly 10 characters, the database should apply a [Space 3] check.
Interactive exercises for Module 2 and beyond require an active plan.