SYSTEM appears in the ISO/IEC SQL:2011 temporal feature within the clause FOR SYSTEM_TIME. When a table is defined with SYSTEM VERSIONING, the database engine automatically keeps historic versions of each row along with system-generated period columns (typically row start and row end timestamps). The FOR SYSTEM_TIME clause lets you read those historic versions without restoring backups. You can retrieve the state of the data at an exact timestamp (AS OF), within a closed or open interval (FROM … TO / BETWEEN … AND), or across the entire history (ALL). This is invaluable for auditing, debugging, regulatory compliance, and point-in-time reporting. Only SELECT statements are allowed with FOR SYSTEM_TIME; DML against historic versions is blocked. Attempting to use SYSTEM on a non-versioned table raises an error.
timestamp_expression
(TIMESTAMP) - exact point in time for AS OFstart_timestamp
(TIMESTAMP) - beginning of interval for FROM / BETWEENend_timestamp
(TIMESTAMP) - end of interval for TO / ANDSQL:2011 temporal specification
SYSTEM_TIME tracks when rows changed according to the database system clock. Application time (also called VALID_TIME) represents when a fact is valid in the business domain. SYSTEM_TIME is automatic; application time is user-defined.
No. The clause is strictly for historical reads. Attempting DML on the results will throw an error such as "FOR SYSTEM_TIME table reference is read-only".
Querying history tables adds I/O because past versions are scanned. Index the period columns and filter as narrowly as possible to minimize overhead.
The database raises an error like "The table does not have SYSTEM_VERSIONING enabled". Enable SYSTEM VERSIONING first or remove the FOR SYSTEM_TIME clause.