January 2008
Intermediate to advanced
384 pages
8h 1m
English
This is a simple problem, but the replies to it illustrate approaches to solutions in any SQL. The problem is a single-column table that holds the time in seconds from some starting time (time zero or t0) of some event. For simplicity, the event times are captured in even seconds from a time zero.
CREATE TABLE Events
(event_time DECIMAL(4,1) NOT NULL PRIMARY KEY
CHECK(event_time = ((10 * event_time)/ 10))
-- whole seconds);
INSERT INTO Events
VALUES (500), (505), (510), (535),
(910), (939), (944), (977);I need to assign a group number to the above values, based on a time interval of 30 seconds. The numbering does not matter, just as long as the numbering increases with the event times. For example, this is a correct result ...
Read now
Unlock full access