There is a table of elephants with fields:id, name, continent (the names are not repeated within one continent)
Link table with a composite key:id, status_id
The status table of elephants ( each elephant has many statuses, the status is not deleted when it is changed, but is added to the table to save the status history, the statuses are unique, the same status cannot be used by different elephants ):status_id, status (местонахождение), date
The goal is to select an elephant and view all its statuses / movements, sorted by date.
After reading this material https://habrahabr.ru/post/193380/ I already doubt the join table, one-to-many connection is obtained, since an elephant can have several statuses, but only one donor can have a status. But then the status table will beid, status (местонахождение), date
and will have to add a unique primary key column apparently for normalization on 1NF?
Example:
id - name - cont 1 - Слон Ярик - Африка 2 - Слон Шарик - Австралия id - status_id 1 - 1 1 - 2 status_id - status - date 1 - Видели в Южной Африке - 2016/10/15 10:10:00 2 - Убежал к морю - 2016/10/16 12:00:00