model
A table is a set of facts about one kind of thing A row is one fact A column is one attribute of that fact
The sample
Two tables carry the whole series:
targets, id , host , port , severityfindings, id , target_id , name
target_id points back to targets.id
That is a foreign key
It stops a finding from referring to a target that does not exist
Keys
| Key | Meaning |
|---|---|
| primary | uniquely identifies a row |
| foreign | points to a row in another table |
| unique | no duplicates , but not the row identity |
A primary key is not optional if you want reliable updates and deletes Without it you are updating by description and hoping
Normal form, short version
Store a fact once If the same host string appears in five tables, one of them should hold it and the others should point to it That is the whole instinct behind normalization
Next
Build the tables in 02 ddl
Posted