Project

General

Profile

« Previous | Next » 

Revision 12164

schemas/vegbien.sql: public_validation_traits: populated queries from validation/aggregating/traits/bien3_validations_traits_bien3.sql

View differences:

trunk/schemas/vegbien.my.sql
3453 3453

  
3454 3454

  
3455 3455

  
3456

  
3457

  
3456 3458
--
3459
-- Name: _01_count_records; Type: VIEW; Schema: public_validation_traits; Owner: -
3460
--
3461

  
3462

  
3463

  
3464

  
3465
--
3466
-- Name: _02_count_trait_names; Type: VIEW; Schema: public_validation_traits; Owner: -
3467
--
3468

  
3469

  
3470

  
3471

  
3472
--
3473
-- Name: _03_list_trait_names; Type: VIEW; Schema: public_validation_traits; Owner: -
3474
--
3475

  
3476

  
3477

  
3478

  
3479
--
3480
-- Name: _04_count_records_per_trait; Type: VIEW; Schema: public_validation_traits; Owner: -
3481
--
3482

  
3483

  
3484

  
3485

  
3486
--
3487
-- Name: _05_count_taxa; Type: VIEW; Schema: public_validation_traits; Owner: -
3488
--
3489

  
3490

  
3491

  
3492

  
3493
--
3494
-- Name: _06_list_taxa; Type: VIEW; Schema: public_validation_traits; Owner: -
3495
--
3496

  
3497

  
3498

  
3499

  
3500
--
3501
-- Name: _07_trait_value_and_units_for_first_5000_records; Type: VIEW; Schema: public_validation_traits; Owner: -
3502
--
3503

  
3504

  
3505

  
3506

  
3507
--
3508
-- Name: _08_taxon_trait_and_value_for_first_5000_records; Type: VIEW; Schema: public_validation_traits; Owner: -
3509
--
3510

  
3511

  
3512

  
3513

  
3514

  
3515

  
3516
--
3457 3517
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
3458 3518
--
3459 3519

  
trunk/schemas/vegbien.sql
5179 5179
ALTER SEQUENCE voucher_voucher_id_seq OWNED BY voucher.voucher_id;
5180 5180

  
5181 5181

  
5182
SET search_path = public_validation_traits, pg_catalog;
5183

  
5182 5184
--
5185
-- Name: _01_count_records; Type: VIEW; Schema: public_validation_traits; Owner: -
5186
--
5187

  
5188
CREATE VIEW _01_count_records AS
5189
 SELECT count(*) AS "totalRecords"
5190
   FROM (public.trait
5191
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
5192
  WHERE (taxonoccurrence.source_id = public.source_by_shortname(("current_schema"())::text));
5193

  
5194

  
5195
--
5196
-- Name: _02_count_trait_names; Type: VIEW; Schema: public_validation_traits; Owner: -
5197
--
5198

  
5199
CREATE VIEW _02_count_trait_names AS
5200
 SELECT count(DISTINCT trait.name) AS traits
5201
   FROM (public.trait
5202
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
5203
  WHERE (taxonoccurrence.source_id = public.source_by_shortname(("current_schema"())::text));
5204

  
5205

  
5206
--
5207
-- Name: _03_list_trait_names; Type: VIEW; Schema: public_validation_traits; Owner: -
5208
--
5209

  
5210
CREATE VIEW _03_list_trait_names AS
5211
 SELECT DISTINCT trait.name AS trait
5212
   FROM (public.trait
5213
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
5214
  WHERE (taxonoccurrence.source_id = public.source_by_shortname(("current_schema"())::text))
5215
  ORDER BY trait.name;
5216

  
5217

  
5218
--
5219
-- Name: _04_count_records_per_trait; Type: VIEW; Schema: public_validation_traits; Owner: -
5220
--
5221

  
5222
CREATE VIEW _04_count_records_per_trait AS
5223
 SELECT trait.name AS trait, 
5224
    count(*) AS measurements
5225
   FROM (public.trait
5226
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
5227
  WHERE (taxonoccurrence.source_id = public.source_by_shortname(("current_schema"())::text))
5228
  GROUP BY trait.name
5229
  ORDER BY trait.name;
5230

  
5231

  
5232
--
5233
-- Name: _05_count_taxa; Type: VIEW; Schema: public_validation_traits; Owner: -
5234
--
5235

  
5236
CREATE VIEW _05_count_taxa AS
5237
 SELECT count(DISTINCT ROW(taxonverbatim.taxonname, taxonverbatim.author)) AS taxa
5238
   FROM public.taxonverbatim
5239
  WHERE (taxonverbatim.source_id = public.source_by_shortname(("current_schema"())::text));
5240

  
5241

  
5242
--
5243
-- Name: _06_list_taxa; Type: VIEW; Schema: public_validation_traits; Owner: -
5244
--
5245

  
5246
CREATE VIEW _06_list_taxa AS
5247
 SELECT DISTINCT concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author) AS taxonwithauthor
5248
   FROM public.taxonverbatim
5249
  WHERE (taxonverbatim.source_id = public.source_by_shortname(("current_schema"())::text))
5250
  ORDER BY concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author);
5251

  
5252

  
5253
--
5254
-- Name: _07_trait_value_and_units_for_first_5000_records; Type: VIEW; Schema: public_validation_traits; Owner: -
5255
--
5256

  
5257
CREATE VIEW _07_trait_value_and_units_for_first_5000_records AS
5258
 SELECT trait.name AS trait, 
5259
    trait.value, 
5260
    trait.units
5261
   FROM (public.trait
5262
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
5263
  WHERE (taxonoccurrence.source_id = public.source_by_shortname(("current_schema"())::text))
5264
  ORDER BY trait.name, trait.value, trait.units
5265
 LIMIT 5000;
5266

  
5267

  
5268
--
5269
-- Name: _08_taxon_trait_and_value_for_first_5000_records; Type: VIEW; Schema: public_validation_traits; Owner: -
5270
--
5271

  
5272
CREATE VIEW _08_taxon_trait_and_value_for_first_5000_records AS
5273
 SELECT concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author) AS taxonwithauthor, 
5274
    trait.name AS trait, 
5275
    trait.value
5276
   FROM ((public.taxonverbatim
5277
   JOIN public.taxondetermination ON (((taxondetermination.taxonverbatim_id = taxonverbatim.taxonverbatim_id) AND taxondetermination.iscurrent)))
5278
   JOIN public.trait USING (taxonoccurrence_id))
5279
  WHERE (taxonverbatim.source_id = public.source_by_shortname(("current_schema"())::text))
5280
  ORDER BY taxonverbatim.taxonname
5281
 LIMIT 5000;
5282

  
5283

  
5284
SET search_path = public, pg_catalog;
5285

  
5286
--
5183 5287
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
5184 5288
--
5185 5289

  

Also available in: Unified diff