| 1 | back to the first page[..][[BR]] |
| 2 | |
| 3 | CREATE TABLE rht.model_mod |
| 4 | ( |
| 5 | mod_id serial NOT NULL, |
| 6 | mod_name character varying(30) NOT NULL, |
| 7 | mod_date date, |
| 8 | mod_description text NOT NULL, |
| 9 | mod_location character varying(25), -- Geographical area to which the model is applied, should be consistent with europe.wso |
| 10 | mod_formula text, |
| 11 | CONSTRAINT model_mod_pkey PRIMARY KEY (mod_id), |
| 12 | CONSTRAINT model_mod_mod_name_key UNIQUE (mod_name) |
| 13 | ); |
| 14 | |
| 15 | DROP TABLE IF EXISTS rht.resultmodel; |
| 16 | CREATE TABLE rht.resultmodel |
| 17 | ( |
| 18 | res_id serial NOT NULL, |
| 19 | res_id_drain integer, |
| 20 | res_value double precision, |
| 21 | res_mod_id integer, |
| 22 | CONSTRAINT resultmodel_pkey PRIMARY KEY (res_id), |
| 23 | CONSTRAINT c_fk_res_mod_id FOREIGN KEY (res_mod_id) |
| 24 | REFERENCES rht.model_mod (mod_id) MATCH SIMPLE |
| 25 | ON UPDATE NO ACTION ON DELETE NO ACTION |
| 26 | ); |
| 27 | |
| 28 | drop table if exists rht.resultmodelBasque; |
| 29 | create table ccm21.resultmodelBasque as ( |
| 30 | select sub1.*, |
| 31 | sub2.res_value as mpa |
| 32 | from |
| 33 | (select wso1_id,dmer,dsource,res_value as mpa, the_geom from ccm21.riversegments join ccm21.resultmodel on res_wso1_id=wso1_id where |
| 34 | res_mod_id=12) as sub1 |
| 35 | join |
| 36 | (select wso1_id, res_value from ccm21.riversegments join ccm21.resultmodel on res_wso1_id=wso1_id where |
| 37 | res_mod_id=15) as sub2 |
| 38 | on sub1.wso1_id=sub2.wso1_id |
| 39 | ); |
| 40 | |
| 41 | create index indextableresultmod on ccm21.resultmodelBasque using gist(the_geom); |