1 |
1243
|
aaronmk
|
SELECT '# specimen replicates' AS ___;
|
2 |
|
|
SELECT count(*) AS count
|
3 |
|
|
FROM specimenreplicate
|
4 |
1249
|
aaronmk
|
WHERE datasource_id =
|
5 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
6 |
1243
|
aaronmk
|
;
|
7 |
|
|
|
8 |
|
|
SELECT '# families' AS ___;
|
9 |
|
|
SELECT count(DISTINCT plantname) AS count
|
10 |
|
|
FROM specimenreplicate
|
11 |
|
|
JOIN taxondetermination USING (taxonoccurrence_id)
|
12 |
|
|
JOIN plantconcept USING (plantconcept_id)
|
13 |
1246
|
aaronmk
|
JOIN plantname
|
14 |
|
|
ON plantname.plantname_id = plantconcept.plantname_id
|
15 |
|
|
AND plantname.rank = 'Family'
|
16 |
1249
|
aaronmk
|
WHERE datasource_id =
|
17 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
18 |
|
|
AND taxondetermination.isoriginal
|
19 |
1243
|
aaronmk
|
;
|
20 |
1246
|
aaronmk
|
|
21 |
|
|
SELECT '# genera' AS ___;
|
22 |
|
|
SELECT count(DISTINCT plantname) AS count
|
23 |
|
|
FROM specimenreplicate
|
24 |
|
|
JOIN taxondetermination USING (taxonoccurrence_id)
|
25 |
|
|
JOIN plantconcept USING (plantconcept_id)
|
26 |
|
|
JOIN plantname
|
27 |
|
|
ON plantname.plantname_id = plantconcept.plantname_id
|
28 |
|
|
AND plantname.rank = 'Genus'
|
29 |
1249
|
aaronmk
|
WHERE datasource_id =
|
30 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
31 |
|
|
AND taxondetermination.isoriginal
|
32 |
1246
|
aaronmk
|
;
|
33 |
|
|
|
34 |
|
|
SELECT '# species' AS ___;
|
35 |
1252
|
aaronmk
|
SELECT
|
36 |
|
|
count(DISTINCT genus_plantname.plantname||','||species_plantname.plantname)
|
37 |
|
|
AS count
|
38 |
1246
|
aaronmk
|
FROM specimenreplicate
|
39 |
1252
|
aaronmk
|
JOIN taxondetermination AS genus_taxondet
|
40 |
|
|
ON genus_taxondet.taxonoccurrence_id = specimenreplicate.taxonoccurrence_id
|
41 |
|
|
AND genus_taxondet.isoriginal
|
42 |
|
|
JOIN plantconcept AS genus_plantconcept
|
43 |
|
|
ON genus_plantconcept.plantconcept_id = genus_taxondet.plantconcept_id
|
44 |
|
|
JOIN plantname AS genus_plantname
|
45 |
|
|
ON genus_plantname.plantname_id = genus_plantconcept.plantname_id
|
46 |
|
|
AND genus_plantname.rank = 'Genus'
|
47 |
|
|
JOIN taxondetermination AS species_taxondet
|
48 |
|
|
ON species_taxondet.taxonoccurrence_id =
|
49 |
|
|
specimenreplicate.taxonoccurrence_id
|
50 |
|
|
AND species_taxondet.isoriginal
|
51 |
|
|
JOIN plantconcept AS species_plantconcept
|
52 |
|
|
ON species_plantconcept.plantconcept_id = species_taxondet.plantconcept_id
|
53 |
|
|
JOIN plantname AS species_plantname
|
54 |
|
|
ON species_plantname.plantname_id = species_plantconcept.plantname_id
|
55 |
|
|
AND species_plantname.rank = 'Species'
|
56 |
1249
|
aaronmk
|
WHERE datasource_id =
|
57 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
58 |
1246
|
aaronmk
|
;
|
59 |
1254
|
aaronmk
|
|
60 |
|
|
SELECT '# binomials' AS ___;
|
61 |
|
|
SELECT count(DISTINCT plantname) AS count
|
62 |
|
|
FROM specimenreplicate
|
63 |
|
|
JOIN taxondetermination USING (taxonoccurrence_id)
|
64 |
|
|
JOIN plantconcept USING (plantconcept_id)
|
65 |
|
|
JOIN plantname
|
66 |
|
|
ON plantname.plantname_id = plantconcept.plantname_id
|
67 |
|
|
AND plantname.rank = 'Binomial'
|
68 |
|
|
WHERE datasource_id =
|
69 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
70 |
|
|
AND taxondetermination.isoriginal
|
71 |
|
|
;
|
72 |
1297
|
aaronmk
|
|
73 |
|
|
SELECT 'collection codes' AS ___;
|
74 |
|
|
SELECT DISTINCT collectioncode_dwc
|
75 |
|
|
FROM specimenreplicate
|
76 |
|
|
WHERE datasource_id =
|
77 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
78 |
|
|
;
|
79 |
|
|
|
80 |
|
|
SELECT '# catalog numbers' AS ___;
|
81 |
|
|
SELECT count(DISTINCT catalognumber_dwc) AS count
|
82 |
|
|
FROM specimenreplicate
|
83 |
|
|
WHERE datasource_id =
|
84 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
85 |
|
|
;
|
86 |
1298
|
aaronmk
|
|
87 |
1300
|
aaronmk
|
SELECT 'duplicate catalog numbers' AS ___;
|
88 |
|
|
SELECT catalognumber_dwc, count(*) AS count
|
89 |
|
|
FROM specimenreplicate
|
90 |
|
|
WHERE datasource_id =
|
91 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
92 |
|
|
GROUP BY catalognumber_dwc
|
93 |
|
|
HAVING count(*) > 1
|
94 |
1302
|
aaronmk
|
ORDER BY catalognumber_dwc NULLS FIRST/* to match MySQL */
|
95 |
1300
|
aaronmk
|
;
|
96 |
|
|
|
97 |
1298
|
aaronmk
|
SELECT '# counties' AS ___;
|
98 |
1325
|
aaronmk
|
SELECT count(DISTINCT namedplace_id) AS count
|
99 |
1298
|
aaronmk
|
FROM specimenreplicate
|
100 |
|
|
JOIN taxonoccurrence USING (taxonoccurrence_id)
|
101 |
|
|
JOIN locationevent USING (locationevent_id)
|
102 |
1325
|
aaronmk
|
JOIN locationdetermination USING (location_id)
|
103 |
|
|
JOIN namedplace USING (namedplace_id)
|
104 |
1298
|
aaronmk
|
WHERE specimenreplicate.datasource_id =
|
105 |
|
|
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
106 |
1325
|
aaronmk
|
AND namedplace.rank = 'county'
|
107 |
1298
|
aaronmk
|
;
|