-- *** before: ***
-- the history of a row was kept by hand: a shadow table
-- and a trigger that copied the old values into it
-- *** in version 2011: ***
CREATE TABLE city_history (
ID INTEGER PRIMARY KEY,
Name VARCHAR(35),
Population INTEGER,
Sys_start TIMESTAMP GENERATED ALWAYS AS ROW START,
Sys_end TIMESTAMP GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
) WITH SYSTEM VERSIONING
-- Support: MS SQL Server 2016 (it wants a HISTORY_TABLE named next to
-- the definition) and MariaDB 10.3. Oracle covers the same ground with
-- Flashback Data Archive rather than the standard syntax. MySQL,
-- PostgreSQL, SQLite, Firebird and Access have nothing of the kind.