Skip to content

Commit 65cbe9e

Browse files
add the Language database example
1 parent 9952c81 commit 65cbe9e

File tree

5 files changed

+1342
-33
lines changed

5 files changed

+1342
-33
lines changed

book/30-schema-design/020-primary-key.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,19 @@ The three questions of entity integrity must be answered not just in theory, but
6565

6666
**Question 1: How do I prevent duplicate records?**
6767
- Each student gets a unique student ID number when they enroll
68-
- The database enforces that no two students can have the same student ID
68+
- To ensure that the student has not previously registered, additional verification is performed to search the existing records. The student may be asked to provide other names that they have used in the past.
69+
- Additional uniqueness constraints may be imposed on other attributes such as drivers license number, passport number, email, social security number, cellphone, etc.
6970
- Before inserting a new student record, the system checks if that student ID already exists
7071

7172
**Question 2: How do I prevent entities sharing the same record?**
72-
- Each student ID can only be assigned to one person
73-
- If a student graduates and the ID is reused years later, the old record must be properly archived
73+
- Each student ID can only be assigned to one person.
74+
- At registration, the university will issue a photo ID card to the student that allows verifying that another student is not pretending to be the student in the records.
75+
- If a student graduates and the ID is reused years later, the old record must be properly archived, although in most systems, such IDs are retired and not reused.
7476

7577
**Question 3: How do I match entities?**
76-
- When a student comes to the registrar's office, they can look up their record by student ID
77-
- The database can quickly find the student's record using the student ID as the primary key
78-
- All related records (grades, courses, payments) can be linked to this student through the student ID
78+
- When a student comes to the registrar's office, they can look up their record by student ID.
79+
- The database can quickly find the student's record using the student ID as the primary key.
80+
- All related records (grades, courses, payments) can be linked to this student through the student ID.
7981

8082
### Example: Laboratory Animal Database
8183

0 commit comments

Comments
 (0)