DROP TABLE T1 IF EXISTS;
CREATE TABLE T1(ID IDENTITY, DT DATE,TI TIME,TS TIMESTAMP);
INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP);
SELECT DAYOFMONTH(DT) FROM T1;
SELECT DAYOFMONTH(TS) FROM T1;
DELETE FROM T1;
INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, DATE'2000-11-10', TIME'10:11:12',TIMESTAMP'2000-12-10 10:11:12');
/*r2000*/SELECT YEAR(TS) FROM T1;
/*r12*/SELECT MONTH(TS) FROM T1;
/*r10*/SELECT DAYOFMONTH(DT) FROM T1;
/*r10*/SELECT DAYOFMONTH(TS) FROM T1;
/*r10-01*/SELECT (DATE'2010-12-20' - DT) YEAR TO MONTH FROM T1;
/*r121*/SELECT (DATE'2010-12-20' - DT) MONTH(4) FROM T1;
/*r9-11*/SELECT (DATE'2010-10-20' - DT) YEAR TO MONTH FROM T1;
/*r9-10*/SELECT (DATE'2010-10-20' - (MAX(DT) + INTERVAL '1' MONTH)) YEAR TO MONTH FROM T1;
DROP TABLE T1
