CREATE TABLE tblunit (
    unit_id integer NOT NULL,
    unit_location character varying(100)
);
Insert into tblunit values(1,'location1');
Insert into tblunit values(2,'location2');
Insert into tblunit values(3,'location3');

CREATE TABLE tbloperator (
    operator_id integer NOT NULL,
    operator_name character varying(100)
);
Insert into tbloperator values(1,'operator1');
Insert into tbloperator values(2,'operator2');
Insert into tbloperator values(3,'operator3');
Insert into tbloperator values(4,'operator4');
Insert into tbloperator values(5,'operator5');
Insert into tbloperator values(6,'operator6');


CREATE TABLE tbloperatorschedule (
    operator_schedule_id bigint NOT NULL,
    operator_id integer,
    schedule_start_time timestamp without time zone,
    schedule_end_time timestamp without time zone,
    unit_id bigint
);
Insert into tbloperatorschedule values(1,1,'2011-12-01 01:00:00','2011-12-01 02:00:00',1);
Insert into tbloperatorschedule values(2,5,'2011-12-01 02:30:00','2011-12-01 04:50:00',1);
Insert into tbloperatorschedule values(3,2,'2011-12-01 04:55:00','2011-12-01 10:20:00',1);
Insert into tbloperatorschedule values(4,1,'2011-12-01 03:00:00','2011-12-01 05:00:00',2);
Insert into tbloperatorschedule values(5,3,'2011-12-01 05:30:00','2011-12-01 09:50:00',2);
Insert into tbloperatorschedule values(6,4,'2011-12-01 09:55:00','2011-12-01 13:20:00',2);
Insert into tbloperatorschedule values(7,6,'2011-12-01 14:00:00','2011-12-01 18:00:00',2);
Insert into tbloperatorschedule values(8,5,'2011-12-01 06:30:00','2011-12-01 14:50:00',3);
Insert into tbloperatorschedule values(9,2,'2011-12-01 14:55:00','2011-12-01 20:20:00',3);

CREATE TABLE tbldata (
    data_id bigint NOT NULL,
    event_time timestamp without time zone DEFAULT now(),
    data_text character varying(100),
    unit_id bigint
);
Insert into tbldata values(1,'2011-12-01 02:30:00','abc',1);
Insert into tbldata values(2,'2011-12-01 06:28:00','abc',2);
Insert into tbldata values(3,'2011-12-01 11:10:00','abc',3);
Insert into tbldata values(4,'2011-12-01 21:30:00','abc',3);