CREATE_ADE_DB.sql 8.62 KB
Newer Older
1
-- This document was automatically created by the ADE-Manager tool of 3DCityDB (https://www.3dcitydb.org) on 2021-03-29 17:59:30 
Rushikesh Padsala's avatar
Rushikesh Padsala committed
2
3
4
5
6
7
8
9
10
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- *********************************** Create tables ************************************** 
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- -------------------------------------------------------------------- 
-- FWEL_energysurvey 
-- -------------------------------------------------------------------- 
CREATE TABLE FWEL_energysurvey
(
    id INTEGER NOT NULL,
11
12
13
14
15
16
17
18
19
20
21
22
    biomasspotentialbioethanol NUMBER,
    biomasspotentialbioethanolun VARCHAR2(1000),
    biomasspotentialbiogas NUMBER,
    biomasspotentialbiogasunit VARCHAR2(1000),
    biomasspotentialforest NUMBER,
    biomasspotentialforestunit VARCHAR2(1000),
    biomasspotentialplantoil NUMBER,
    biomasspotentialplantoilunit VARCHAR2(1000),
    biomasspotentialresidualso_1 VARCHAR2(1000),
    biomasspotentialresidualsoli NUMBER,
    biomasspotentialsolidfuel NUMBER,
    biomasspotentialsolidfueluni VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
23
24
25
26
27
28
    biomassprimaryenergypotent_1 VARCHAR2(1000),
    biomassprimaryenergypotentia NUMBER,
    biomasstoelectricitypotent_1 VARCHAR2(1000),
    biomasstoelectricitypotentia NUMBER,
    biomasstothermalpotential NUMBER,
    biomasstothermalpotentialuni VARCHAR2(1000),
29
30
    biomassweight NUMBER,
    biomassweightunit VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    electricitypotentialfrompv_1 VARCHAR2(1000),
    electricitypotentialfrompvbu NUMBER,
    landusesurve_energysurvey_id INTEGER,
    residentialelectricitydema_1 VARCHAR2(1000),
    residentialelectricitydemand NUMBER,
    spacecoolingdemand NUMBER,
    spacecoolingdemandunit VARCHAR2(1000),
    spaceheatingdemand NUMBER,
    spaceheatingdemandunit VARCHAR2(1000),
    PRIMARY KEY (id)
);

-- -------------------------------------------------------------------- 
-- FWEL_foodsurvey 
-- -------------------------------------------------------------------- 
CREATE TABLE FWEL_foodsurvey
(
    id INTEGER NOT NULL,
49
50
51
52
    animalcalorie INTEGER,
    animalcalorieunit VARCHAR2(1000),
    cropcalorie INTEGER,
    cropcalorieunit VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
53
54
55
56
57
58
59
60
61
62
63
64
65
    foodcategory VARCHAR2(1000),
    foodcategory_codespace VARCHAR2(1000),
    foodconsumption NUMBER,
    foodconsumptionunit VARCHAR2(1000),
    fooddemand NUMBER,
    fooddemandunit VARCHAR2(1000),
    foodproduction NUMBER,
    foodproductionenergydemand NUMBER,
    foodproductionengerydemandun VARCHAR2(1000),
    foodproductionunit VARCHAR2(1000),
    foodproductionwaterdemand NUMBER,
    foodproductionwaterdemanduni VARCHAR2(1000),
    landusesurvey_foodsurvey_id INTEGER,
66
67
    vegetalcalorie INTEGER,
    vegetalcalorieunit VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    PRIMARY KEY (id)
);

-- -------------------------------------------------------------------- 
-- FWEL_land_use 
-- -------------------------------------------------------------------- 
CREATE TABLE FWEL_land_use
(
    id INTEGER NOT NULL,
    fweareaname VARCHAR2(1000),
    fwesystemname VARCHAR2(1000),
    PRIMARY KEY (id)
);

-- -------------------------------------------------------------------- 
-- FWEL_landusesurvey 
-- -------------------------------------------------------------------- 
CREATE TABLE FWEL_landusesurvey
(
    id INTEGER NOT NULL,
    buildingfootprintarea NUMBER,
    buildingfootprintarea_uom VARCHAR2(1000),
90
91
    croptype VARCHAR2(1000),
    croptype_codespace VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
92
93
94
    land_use_consistsoffwesur_id INTEGER,
    objectclass_id INTEGER,
    population INTEGER,
95
96
    soiltype VARCHAR2(1000),
    soiltype_codespace VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    surfacearea NUMBER,
    surfacearea_uom VARCHAR2(1000),
    surveydescription VARCHAR2(1000),
    surveyyear INTEGER,
    surveyyearversion NUMBER,
    PRIMARY KEY (id)
);

-- -------------------------------------------------------------------- 
-- FWEL_watersurvey 
-- -------------------------------------------------------------------- 
CREATE TABLE FWEL_watersurvey
(
    id INTEGER NOT NULL,
    domestichotwaterdemand NUMBER,
    domestichotwaterdemandunit VARCHAR2(1000),
    domestichotwaterenergydema_1 VARCHAR2(1000),
    domestichotwaterenergydemand NUMBER,
    domesticsolidwaste NUMBER,
    domesticsolidwasteunit VARCHAR2(1000),
    domesticwaterdemand NUMBER,
    domesticwaterdemandunit VARCHAR2(1000),
    domesticwaterwaste NUMBER,
    domesticwaterwasteunit VARCHAR2(1000),
121
122
    irrigationdemand NUMBER,
    irrigationdemandunit VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
123
124
125
    landusesurvey_watersurvey_id INTEGER,
    totaldomesticwaste NUMBER,
    totaldomesticwasteunit VARCHAR2(1000),
126
127
    transpirationloss NUMBER,
    transpirationlossunit VARCHAR2(1000),
Rushikesh Padsala's avatar
Rushikesh Padsala committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
    PRIMARY KEY (id)
);

-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- *********************************** Create foreign keys ******************************** 
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- -------------------------------------------------------------------- 
-- FWEL_energysurvey 
-- -------------------------------------------------------------------- 
ALTER TABLE FWEL_energysurvey ADD CONSTRAINT FWEL_energysurvey_fk FOREIGN KEY (id)
REFERENCES FWEL_landusesurvey (id);

ALTER TABLE FWEL_energysurvey ADD CONSTRAINT FWEL_energy_landu_energ_fk FOREIGN KEY (landusesurve_energysurvey_id)
REFERENCES FWEL_landusesurvey (id);

-- -------------------------------------------------------------------- 
-- FWEL_foodsurvey 
-- -------------------------------------------------------------------- 
ALTER TABLE FWEL_foodsurvey ADD CONSTRAINT FWEL_foodsurvey_fk FOREIGN KEY (id)
REFERENCES FWEL_landusesurvey (id);

ALTER TABLE FWEL_foodsurvey ADD CONSTRAINT FWEL_foodsu_landu_foods_fk FOREIGN KEY (landusesurvey_foodsurvey_id)
REFERENCES FWEL_landusesurvey (id);

-- -------------------------------------------------------------------- 
-- FWEL_land_use 
-- -------------------------------------------------------------------- 
ALTER TABLE FWEL_land_use ADD CONSTRAINT FWEL_land_use_fk FOREIGN KEY (id)
REFERENCES land_use (id);

-- -------------------------------------------------------------------- 
-- FWEL_landusesurvey 
-- -------------------------------------------------------------------- 
ALTER TABLE FWEL_landusesurvey ADD CONSTRAINT FWEL_landusesurvey_fk FOREIGN KEY (id)
REFERENCES cityobject (id);

ALTER TABLE FWEL_landusesurvey ADD CONSTRAINT FWEL_landusesu_objectcl_fk FOREIGN KEY (objectclass_id)
REFERENCES objectclass (id);

ALTER TABLE FWEL_landusesurvey ADD CONSTRAINT FWEL_land_land_use_cons_fk FOREIGN KEY (land_use_consistsoffwesur_id)
REFERENCES FWEL_land_use (id);

-- -------------------------------------------------------------------- 
-- FWEL_watersurvey 
-- -------------------------------------------------------------------- 
ALTER TABLE FWEL_watersurvey ADD CONSTRAINT FWEL_watersurvey_fk FOREIGN KEY (id)
REFERENCES FWEL_landusesurvey (id);

ALTER TABLE FWEL_watersurvey ADD CONSTRAINT FWEL_waters_landu_water_fk FOREIGN KEY (landusesurvey_watersurvey_id)
REFERENCES FWEL_landusesurvey (id);

-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- *********************************** Create Indexes ************************************* 
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- -------------------------------------------------------------------- 
-- FWEL_energysurvey 
-- -------------------------------------------------------------------- 
CREATE INDEX FWEL_energ_landu_energ_fkx ON FWEL_energysurvey (landusesurve_energysurvey_id);

-- -------------------------------------------------------------------- 
-- FWEL_foodsurvey 
-- -------------------------------------------------------------------- 
CREATE INDEX FWEL_foods_landu_foods_fkx ON FWEL_foodsurvey (landusesurvey_foodsurvey_id);

-- -------------------------------------------------------------------- 
-- FWEL_landusesurvey 
-- -------------------------------------------------------------------- 
CREATE INDEX FWEL_land_land_use_con_fkx ON FWEL_landusesurvey (land_use_consistsoffwesur_id);

CREATE INDEX FWEL_landuses_objectcl_fkx ON FWEL_landusesurvey (objectclass_id);

-- -------------------------------------------------------------------- 
-- FWEL_watersurvey 
-- -------------------------------------------------------------------- 
CREATE INDEX FWEL_water_landu_water_fkx ON FWEL_watersurvey (landusesurvey_watersurvey_id);

-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- *********************************** Create Sequences *********************************** 
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++