Here is an interesting case that I think has almost certainly already been worked out in database theory.
CREATE TABLE occurrences {
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
permid integer NOT NULL,
authorizer integer REFERENCES persons("id") NOT NULL, -- Whoever was the authorizer of the enterer
enterer integer REFERENCES persons("id") NOT NULL, -- Whoever made the entry or edit
taxon integer REFERENCES taxa("id") NOT NULL, -- the taxon in question
reidentification integer REFERENCES occurrences("id"),
collection integer REFERENCES collections("id") NOT NULL, -- collection taxon belongs to
reference integer REFERENCES references("id") NOT NULL,
preceded_by integer REFERENCES opinions("id"),
succeeded_by integer REFERENCES opinions("id")
};
At a conceptual level, the collection and reference field actually map the permid not the primary key id. If we map it to the primary key id, then we need to make sure the occurrences table is updated every time the collection or reference table is updated.
Here is an interesting case that I think has almost certainly already been worked out in database theory.
At a conceptual level, the collection and reference field actually map the permid not the primary key id. If we map it to the primary key id, then we need to make sure the occurrences table is updated every time the collection or reference table is updated.