-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements.  See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License.  You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

CREATE TABLE DEPARTMENT(ID INTEGER NOT NULL,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NULL,UNIQUE(ID))
CREATE TABLE EMPLOYEE(ID INTEGER NOT NULL,DEPARTMENT_ID INTEGER NOT NULL,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NULL,UNIQUE(ID))
CREATE TABLE USER(UID INTEGER IDENTITY PRIMARY KEY,NAME VARCHAR,FIRSTNAME VARCHAR,UNAME VARCHAR,PWD VARCHAR,ROLE VARCHAR, UNIQUE(UNAME))
CREATE TABLE GROUPS(GID INTEGER IDENTITY PRIMARY KEY,GNAME VARCHAR,UNIQUE(GNAME))
CREATE TABLE USER_GROUPS(UID INTEGER,GID INTEGER,UNIQUE(UID,GID),FOREIGN KEY(UID)REFERENCES USER(UID),FOREIGN KEY(GID)REFERENCES GROUPS(GID))
CREATE TABLE STATE_TAX(CATEGORY VARCHAR NOT NULL,GROSSTAX_COLLECTED DOUBLE NOT NULL,NETTAX_COLLECTED DOUBLE NOT NULL,YEAR INTEGER NOT NULL)
CREATE TABLE MEDIA(ID INTEGER IDENTITY PRIMARY KEY,IMAGE BINARY,MIMETYPE VARCHAR)
CREATE TABLE SOURCEPROPS(SOURCE VARCHAR NOT NULL,NAMESPACE VARCHAR NOT NULL,NAME VARCHAR NOT NULL,VALUE VARCHAR NOT NULL,CONSTRAINT SYS_CT_11 UNIQUE(SOURCE,NAMESPACE,NAME))
CREATE TABLE OJB_HL_SEQ(TABLENAME VARCHAR(175) NOT NULL,FIELDNAME VARCHAR(70) NOT NULL,MAX_KEY BIGINT,GRAB_SIZE INTEGER,VERSION INTEGER,CONSTRAINT SYS_PK_OJB_HL_SEQ PRIMARY KEY(TABLENAME,FIELDNAME))
CREATE TABLE QUERY(ID BIGINT IDENTITY PRIMARY KEY,USER_ID VARCHAR NOT NULL,Q_DATE TIMESTAMP,Q_BOOL VARCHAR,Q_NAME VARCHAR,Q_TYPE VARCHAR,Q_SIZE BIGINT,UNIQUE(ID))
CREATE TABLE CRITERION(ID BIGINT IDENTITY PRIMARY KEY,Q_ID BIGINT,C_FIELD VARCHAR,C_MATCH VARCHAR,C_TERM VARCHAR,CONSTRAINT SYS_FK_20 FOREIGN KEY(Q_ID) REFERENCES QUERY(ID),UNIQUE(ID))
CREATE USER SA PASSWORD "" ADMIN
SET WRITE_DELAY 60
INSERT INTO USER VALUES (1, 'Mustermann', 'Max', 'guest', 'guest', 'guest')
INSERT INTO USER VALUES (2, 'Mustermann', 'Heidi', 'cocoon', 'cocoon', 'administrator')
INSERT INTO USER VALUES (3, 'User', 'Default', 'anonymous', 'anonymous', 'guest')
INSERT INTO DEPARTMENT VALUES(1,'Development','<span>Department producing software packages, <i>on time</i>, and <i>bug free</i>.</span>')
INSERT INTO DEPARTMENT VALUES(2,'Management','<span>Department spending all the budget on <i>meetings</i> and <i>donuts</i>.</span>')
INSERT INTO DEPARTMENT VALUES(3,'Testers','<span>Department capable of finding issues in <i>bug free</i> software packages.</span>')
INSERT INTO EMPLOYEE VALUES(1,1,'Donald Ball','')
INSERT INTO EMPLOYEE VALUES(2,1,'Sylvain Wallez','')
INSERT INTO EMPLOYEE VALUES(3,1,'Carsten Ziegeler','')
INSERT INTO EMPLOYEE VALUES(4,1,'Torsten Curdt','')
INSERT INTO EMPLOYEE VALUES(5,1,'Marcus Crafter','')
INSERT INTO EMPLOYEE VALUES(6,1,'Ovidiu Predescu','')
INSERT INTO EMPLOYEE VALUES(7,1,'Christian Haul','')
INSERT INTO EMPLOYEE VALUES(8,2,'Stefano Mazzocchi','')
INSERT INTO EMPLOYEE VALUES(9,3,'Pierpaolo Fumagalli','')
INSERT INTO EMPLOYEE VALUES(10,3,'Davanum Srinivas','')
INSERT INTO EMPLOYEE VALUES(11,3,'Antonio Gallardo','')
INSERT INTO EMPLOYEE VALUES(12,1,'Jeremy Quinn','')
INSERT INTO STATE_TAX VALUES('State Sales And Use',6.263250997E9,6.213961851E9,2000)
INSERT INTO STATE_TAX VALUES('Local Sales And Use',1.321129345E9,1.321129345E9,2000)
INSERT INTO STATE_TAX VALUES('Resort Area Excise',718624.0E0,718624.0E0,2000)
INSERT INTO STATE_TAX VALUES('State Personal Income',8.983891961E9,8.084576329E9,2000)
INSERT INTO STATE_TAX VALUES('Corporation Franchise',1.219484766E9,1.029883951E9,2000)
INSERT INTO STATE_TAX VALUES('Motor Vehicle Fuel',1.418996649E9,1.404945725E9,2000)
INSERT INTO STATE_TAX VALUES('Public Utility Excise',7.04245493E8,6.75339746E8,2000)
INSERT INTO STATE_TAX VALUES('Kilowatt-Hour Excise',0.0E0,0.0E0,2000)
INSERT INTO STATE_TAX VALUES('Cigarette Excise',2.89795508E8,2.87710095E8,2000)
INSERT INTO STATE_TAX VALUES('Dealers in Intangibles',5055311.0E0,2.2333722E7,2000)
INSERT INTO STATE_TAX VALUES('Motor Fuel Use',2.2615436E7,6.6889345E7,2000)
INSERT INTO STATE_TAX VALUES('Alchoholic Beverage Excise',5.6125329E7,5.5993783E7,2000)
INSERT INTO STATE_TAX VALUES('Replacement Tire Fee',3339367.0E0,3339367.0E0,2000)
INSERT INTO STATE_TAX VALUES('Local Alchoholic Beverage',6284465.0E0,5851787.0E0,2000)
INSERT INTO STATE_TAX VALUES('Horse Racing',1.6582056E7,1.7321198E7,2000)
INSERT INTO STATE_TAX VALUES('Severance',8295336.0E0,7981539.0E0,2000)
INSERT INTO STATE_TAX VALUES('School District Income',1.50083042E8,1.61257059E8,2000)
INSERT INTO STATE_TAX VALUES('State Sales And Use',6.287758244E9,6.23711041E9,2001)
INSERT INTO STATE_TAX VALUES('Local Sales And Use',1.352436625E9,1.352436625E9,2001)
INSERT INTO STATE_TAX VALUES('Resort Area Excise',719420.0E0,719420.0E0,2001)
INSERT INTO STATE_TAX VALUES('State Personal Income',9.221429278E9,8.119314587E9,2001)
INSERT INTO STATE_TAX VALUES('Corporation Franchise',1.158910767E9,9.72967198E8,2001)
INSERT INTO STATE_TAX VALUES('Motor Vehicle Fuel',1.325132798E9,1.307275001E9,2001)
INSERT INTO STATE_TAX VALUES('Public Utility Excise',6.91925015E8,6.7431469E8,2001)
INSERT INTO STATE_TAX VALUES('Kilowatt-Hour Excise',3.8026261E7,3.8026261E7,2001)
INSERT INTO STATE_TAX VALUES('Cigarette Excise',2.83978172E8,2.82481419E8,2001)
INSERT INTO STATE_TAX VALUES('Dealers in Intangibles',2.4913075E7,2.4881108E7,2001)
INSERT INTO STATE_TAX VALUES('Motor Fuel Use',7.5662992E7,7.5311561E7,2001)
INSERT INTO STATE_TAX VALUES('Alchoholic Beverage Excise',5.5862063E7,5.5740722E7,2001)
INSERT INTO STATE_TAX VALUES('Replacement Tire Fee',3470795.0E0,3470795.0E0,2001)
INSERT INTO STATE_TAX VALUES('Local Alchoholic Beverage',5851787.0E0,5851787.0E0,2001)
INSERT INTO STATE_TAX VALUES('Horse Racing',1.7921198E7,1.7321198E7,2001)
INSERT INTO STATE_TAX VALUES('Severance',7981539.0E0,7967438.0E0,2001)
INSERT INTO STATE_TAX VALUES('School District Income',1.61257059E8,1.53238001E8,2001)
INSERT INTO QUERY VALUES(1,'anon','1970-01-01 01:00:00.0',NULL,'test','simple',20)
INSERT INTO CRITERION VALUES(1,1,'any','any','cocoon')
