Revision 4965
Added by Aaron Marcuse-Kubitza about 12 years ago
vegbien.my.sql | ||
---|---|---|
820 | 820 |
plantcode text, |
821 | 821 |
canon_taxonpath_id int(11), |
822 | 822 |
taxon_id int(11), |
823 |
scientificname text,
|
|
823 |
taxonomicname text,
|
|
824 | 824 |
author text, |
825 |
scientificnamewithauthor text,
|
|
825 |
taxonomicnamewithauthor text,
|
|
826 | 826 |
domain text, |
827 | 827 |
kingdom text, |
828 | 828 |
phylum text, |
... | ... | |
870 | 870 |
|
871 | 871 |
|
872 | 872 |
-- |
873 |
-- Name: COLUMN taxonpath.scientificname; Type: COMMENT; Schema: public; Owner: -
|
|
873 |
-- Name: COLUMN taxonpath.taxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
874 | 874 |
-- |
875 | 875 |
|
876 | 876 |
|
... | ... | |
884 | 884 |
|
885 | 885 |
|
886 | 886 |
-- |
887 |
-- Name: COLUMN taxonpath.scientificnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
887 |
-- Name: COLUMN taxonpath.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
888 | 888 |
-- |
889 | 889 |
|
890 | 890 |
|
... | ... | |
993 | 993 |
-- |
994 | 994 |
|
995 | 995 |
CREATE VIEW analytical_db_view AS |
996 |
SELECT datasource.organizationname AS `dataSourceName`, taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.scientificnamewithauthor, taxonpath.scientificname) AS taxon, taxonpath.author AS `taxonAuthor`, taxonpath.variety AS `taxonMorphospecies`, placepath.country, placepath.stateprovince AS `stateProvince`, placepath.county AS `countyParish`, taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS `collectionNumber`, array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], CAST(' ' AS text)) AS `identifiedBy`, aggregateoccurrence.collectiondate AS `observationDate`, location.authorlocationcode AS `plotCode`, functions._m2_to_ha(location.area_m2) AS `plotAreaHa`, method.name AS `plotMethod`, locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS `isCultivated`, taxonoccurrence.cultivatedbasis AS `isCultivatedReason`, functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS `pctCover` FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
996 |
SELECT datasource.organizationname AS `dataSourceName`, taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.taxonomicnamewithauthor, taxonpath.taxonomicname) AS taxon, taxonpath.author AS `taxonAuthor`, taxonpath.variety AS `taxonMorphospecies`, placepath.country, placepath.stateprovince AS `stateProvince`, placepath.county AS `countyParish`, taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS `collectionNumber`, array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], CAST(' ' AS text)) AS `identifiedBy`, aggregateoccurrence.collectiondate AS `observationDate`, location.authorlocationcode AS `plotCode`, functions._m2_to_ha(location.area_m2) AS `plotAreaHa`, method.name AS `plotMethod`, locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS `isCultivated`, taxonoccurrence.cultivatedbasis AS `isCultivatedReason`, functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS `pctCover` FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
997 | 997 |
|
998 | 998 |
|
999 | 999 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: Replaced "scientific name" with "taxonomic name" for schema-wide consistency and for consistency with the taxon/taxonomic name vocabulary