wiki:Model Results Spain

Version 1 (modified by celine, 13 years ago) (diff)

--

back to the first page..

CREATE TABLE rht.model_mod (

mod_id serial NOT NULL, mod_name character varying(30) NOT NULL, mod_date date, mod_description text NOT NULL, mod_location character varying(25), -- Geographical area to which the model is applied, should be consistent with europe.wso mod_formula text, CONSTRAINT model_mod_pkey PRIMARY KEY (mod_id), CONSTRAINT model_mod_mod_name_key UNIQUE (mod_name)

);

DROP TABLE IF EXISTS rht.resultmodel; CREATE TABLE rht.resultmodel (

res_id serial NOT NULL, res_id_drain integer, res_value double precision, res_mod_id integer, CONSTRAINT resultmodel_pkey PRIMARY KEY (res_id), CONSTRAINT c_fk_res_mod_id FOREIGN KEY (res_mod_id)

REFERENCES rht.model_mod (mod_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION

);

drop table if exists rht.resultmodelBasque; create table ccm21.resultmodelBasque as ( select sub1.*,

sub2.res_value as mpa

from

(select wso1_id,dmer,dsource,res_value as mpa, the_geom from ccm21.riversegments join ccm21.resultmodel on res_wso1_id=wso1_id where res_mod_id=12) as sub1

join

(select wso1_id, res_value from ccm21.riversegments join ccm21.resultmodel on res_wso1_id=wso1_id where res_mod_id=15) as sub2 on sub1.wso1_id=sub2.wso1_id

);

create index indextableresultmod on ccm21.resultmodelBasque using gist(the_geom);