16.20 - 例 - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL日付と時刻の関数および式

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
プログラミング リファレンス
featnum
B035-1211-162K-JPN
CREATE MULTISET TABLE employee(
 empno INTEGER,
 ename VARCHAR(50),
 deptno INTEGER,
 jobstart TIMESTAMP WITH TIME ZONE NOT NULL 
   GENERATED ALWAYS AS ROW START,
 jobend TIMESTAMP WITH TIME ZONE NOT NULL AS 
   GENERATED ALWAYS AS ROW END,
 PERIOD FOR SYSTEM_TIME(jobstart,jobend)
 )
 PRIMARY INDEX(empno) WITH SYSTEM VERSIONING;

テーブルに以下の行が含まれているとします。

empno ename  deptno                          jobstart                            jobend

----- ------ ------  --------------------------------  --------------------------------

1025 John      999  2005-02-03 12:12:12.123456+00:00  9999-12-31 23:59:59.999999+00:00

次のSELECT文の結果は次のとおりです。

SELECT empno,ename(CHAR(6)) FROM employee 
 WHERE END(SYSTEM_TIME) IS UNTIL_CLOSED;

empno ename
------ ------
  1025 John


SELECT empno,ename(CHAR(6)) FROM employee 
 WHERE END(SYSTEM_TIME) IS NOT UNTIL_CLOSED;

*** Query completed. No rows found.