Alterna · учебный материал
Fields, records and keys
Field types, mandatory values, primary key and data minimization.
Что в этом материале
- Schematic before insertion
- Key — Not a Name
- How to Select Key and Field Type
Содержание и основные понятия
01
Schematic before insertion
Field
Type
Rule
ID books
Text
Primary key, unique.
Name
Text
Mandatory field.
Year issued
Number
In a reasonable range.
Issued
Yes/No
Doesn't keep an arbitrary text.
02
Key — Not a Name
Why?
The name "Robots beside" can be repeated and the ID
B-103
The primary key should not depend on typing, changing the name or personal data.
Identify the minimum set of fields required for a question to the database.
03
How to Select Key and Field Type
Decision
Good choice.
Problem Choice
Primary Key
Stable unique ID
FIO, name or variable telephone
Date
Date type or ISO value
arbitrary line "tomorrow"
Category
Handbook or test set
dozens of versions of one writing
Number
whole with limit ≥ 0
Line with unit inside
A composite key is needed if the uniqueness is determined by a combination of fields. The artificial ID does not eliminate additional limitations on the uniqueity of the subject area.