1--
2-- TIME
3--
4
5CREATE TABLE TIME_TBL (f1 time(2));
6
7INSERT INTO TIME_TBL VALUES ('00:00');
8INSERT INTO TIME_TBL VALUES ('01:00');
9-- as of 7.4, timezone spec should be accepted and ignored
10INSERT INTO TIME_TBL VALUES ('02:03 PST');
11INSERT INTO TIME_TBL VALUES ('11:59 EDT');
12INSERT INTO TIME_TBL VALUES ('12:00');
13INSERT INTO TIME_TBL VALUES ('12:01');
14INSERT INTO TIME_TBL VALUES ('23:59');
15INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM');
16
17INSERT INTO TIME_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
18INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
19-- this should fail (the timezone offset is not known)
20INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York');
21
22
23SELECT f1 AS "Time" FROM TIME_TBL;
24
25SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07';
26
27SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07';
28
29SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00';
30
31SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00';
32
33--
34-- TIME simple math
35--
36-- We now make a distinction between time and intervals,
37-- and adding two times together makes no sense at all.
38-- Leave in one query to show that it is rejected,
39-- and do the rest of the testing in horology.sql
40-- where we do mixed-type arithmetic. - thomas 2000-12-02
41
42SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
43