home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Intermedia 1998 January
/
inter1_98.iso
/
biznes
/
timlog10
/
_setup.1
/
TimeLogger.sql
< prev
next >
Wrap
Text File
|
1997-07-31
|
2KB
|
63 lines
CREATE DATABASE "TimeLogger.gdb" PAGE_SIZE 1024
CREATE DOMAIN EMP AS CHAR(6);
CREATE DOMAIN CUST AS CHAR(8);
CREATE DOMAIN JOB AS CHAR(16);
CREATE DOMAIN TASK AS CHAR(24);
CREATE DOMAIN YESNO AS CHAR(1)
check(value in ('Y','N'));
CREATE TABLE CUST (ID CUST NOT NULL,
NAME VARCHAR(32),
RATE DOUBLE PRECISION,
FACTOR DOUBLE PRECISION,
PRIMARY KEY (ID));
CREATE TABLE EMP (ID EMP NOT NULL,
NAME VARCHAR(32),
FACTOR DOUBLE PRECISION,
PAYRATE DOUBLE PRECISION,
PRIMARY KEY (ID));
CREATE TABLE JOB (CUST CUST NOT NULL,
ID JOB NOT NULL,
CUSTPO VARCHAR(20),
LIMIT DOUBLE PRECISION,
RATE DOUBLE PRECISION,
DESCRIPTION VARCHAR(80),
REMINDER YESNO default 'N' NOT NULL,
NOTES BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
PRIMARY KEY (CUST, ID));
CREATE TABLE TASK (CUST CUST NOT NULL,
JOB JOB NOT NULL,
ID TASK NOT NULL,
DESCRIPTION VARCHAR(80),
REMINDER YESNO default 'N' NOT NULL,
NOTES BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
CONSTRAINT PK_TASK PRIMARY KEY (CUST, JOB, ID));
CREATE TABLE TIME_LOG (TIME DATE NOT NULL,
CUST CUST,
JOB JOB,
TASK TASK,
SUBTASK TASK,
RATE DOUBLE PRECISION,
FACTOR DOUBLE PRECISION,
NOTES BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
DESCRIPTION VARCHAR(255),
HOURS DOUBLE PRECISION,
PAYRATE DOUBLE PRECISION,
EMP CHAR(6),
TEMP CHAR(1),
BILLED YESNO DEFAULT 'N'
,
TIME_STAMP DATE NOT NULL,
CONSTRAINT TIME_LOG_PK PRIMARY KEY (TIME_STAMP));
CREATE INDEX JOB_REMINDER_IDX ON JOB(REMINDER, CUST, ID);
CREATE INDEX TASK_REMINDER_IDX ON TASK(REMINDER, CUST, JOB, ID);
CREATE UNIQUE DESCENDING INDEX TIME2 ON TIME_LOG(TIME);
ALTER TABLE JOB ADD FOREIGN KEY (CUST) REFERENCES CUST(ID);
ALTER TABLE TASK ADD FOREIGN KEY (CUST, JOB) REFERENCES JOB(CUST, ID);