-
Notifications
You must be signed in to change notification settings - Fork 0
/
testdb.script
66 lines (66 loc) · 3.74 KB
/
testdb.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
SET DATABASE UNIQUE NAME HSQLDB762020D1CF
SET DATABASE GC 0
SET DATABASE DEFAULT RESULT MEMORY ROWS 0
SET DATABASE EVENT LOG LEVEL 0
SET DATABASE TRANSACTION CONTROL LOCKS
SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED
SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE
SET DATABASE TEXT TABLE DEFAULTS ''
SET DATABASE SQL NAMES FALSE
SET DATABASE SQL REFERENCES FALSE
SET DATABASE SQL SIZE TRUE
SET DATABASE SQL TYPES FALSE
SET DATABASE SQL TDC DELETE TRUE
SET DATABASE SQL TDC UPDATE TRUE
SET DATABASE SQL CONCAT NULLS TRUE
SET DATABASE SQL UNIQUE NULLS TRUE
SET DATABASE SQL CONVERT TRUNCATE TRUE
SET DATABASE SQL AVG SCALE 0
SET DATABASE SQL DOUBLE NAN TRUE
SET FILES WRITE DELAY 500 MILLIS
SET FILES BACKUP INCREMENT TRUE
SET FILES CACHE SIZE 10000
SET FILES CACHE ROWS 50000
SET FILES SCALE 32
SET FILES LOB SCALE 32
SET FILES DEFRAG 0
SET FILES NIO TRUE
SET FILES NIO SIZE 256
SET FILES LOG TRUE
SET FILES LOG SIZE 50
CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e'
ALTER USER SA SET LOCAL TRUE
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
SET SCHEMA PUBLIC
CREATE MEMORY TABLE PUBLIC.PATIENT(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(32) NOT NULL,SURNAME VARCHAR(32) NOT NULL,PATRONYMIC VARCHAR(32) NOT NULL,PHONE_NUMBER VARCHAR(32) NOT NULL)
ALTER TABLE PUBLIC.PATIENT ALTER COLUMN ID RESTART WITH 9
CREATE MEMORY TABLE PUBLIC.DOCTOR(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(32) NOT NULL,SURNAME VARCHAR(32) NOT NULL,PATRONYMIC VARCHAR(32) NOT NULL,SPECIALIZATION VARCHAR(32) NOT NULL)
ALTER TABLE PUBLIC.DOCTOR ALTER COLUMN ID RESTART WITH 10
CREATE MEMORY TABLE PUBLIC.PRESCRIPTION(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(160) NOT NULL,PATIENT_ID BIGINT NOT NULL,DOCTOR_ID BIGINT NOT NULL,DATE_CREATED DATE NOT NULL,EXPIRATION_DATE DATE NOT NULL,PRIORITY VARCHAR(32) NOT NULL,CONSTRAINT FK_PATIENT_PRESCRIPTION FOREIGN KEY(PATIENT_ID) REFERENCES PUBLIC.PATIENT(ID),CONSTRAINT FK_DOCTOR_PRESCRIPTION FOREIGN KEY(DOCTOR_ID) REFERENCES PUBLIC.DOCTOR(ID))
ALTER TABLE PUBLIC.PRESCRIPTION ALTER COLUMN ID RESTART WITH 9
ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1
SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC
GRANT DBA TO SA
SET SCHEMA SYSTEM_LOBS
INSERT INTO BLOCKS VALUES(0,2147483647,0)
SET SCHEMA PUBLIC
INSERT INTO PATIENT VALUES(1,'Cameron','Howard','John','1112221234')
INSERT INTO PATIENT VALUES(2,'Jayden','Barker','Isaiah','1112222345')
INSERT INTO PATIENT VALUES(3,'Edward','Erwin','Jasper','1112223456')
INSERT INTO PATIENT VALUES(4,'Sampson','Sampson','Abraham','1112224567')
INSERT INTO PATIENT VALUES(5,'Emily','Taylor','Francis','1112225678')
INSERT INTO DOCTOR VALUES(1,'Alton','Reese','Freddie','Anesthesiology')
INSERT INTO DOCTOR VALUES(2,'Iris','Hanson','Emilio','Cardiology')
INSERT INTO DOCTOR VALUES(3,'Dorothy','Olson','Wilbert','Surgery')
INSERT INTO DOCTOR VALUES(4,'Kenneth','Houston','Edwin','Immunology')
INSERT INTO DOCTOR VALUES(5,'Neal','Padilla','Garrett','Dermatology')
INSERT INTO PRESCRIPTION VALUES(1,'example1',1,1,'2020-12-02','2020-12-17','NORMAL')
INSERT INTO PRESCRIPTION VALUES(2,'example2',2,1,'2020-12-02','2020-12-23','CITO')
INSERT INTO PRESCRIPTION VALUES(3,'example3',4,4,'2020-12-02','2020-12-31','NORMAL')
INSERT INTO PRESCRIPTION VALUES(4,'example4',2,4,'2020-12-02','2020-12-14','NORMAL')
INSERT INTO PRESCRIPTION VALUES(5,'example5',3,2,'2020-12-02','2020-12-09','CITO')