Revision 514
Added by Aaron Marcuse-Kubitza almost 13 years ago
inputs/SALVIAS/verify/plots.ref.sql | ||
---|---|---|
1 |
SELECT '# projects' AS ___; |
|
2 |
SELECT count(*) AS count FROM projects; |
|
3 |
|
|
4 |
SELECT 'projects' AS ___; |
|
5 |
SELECT CAST(project_id AS char) AS project FROM projects ORDER BY project; |
|
6 |
|
|
7 |
SELECT 'each project\'s # plots' AS ___; |
|
8 |
SELECT |
|
9 |
CAST(projects.project_id AS char) AS project |
|
10 |
, count(PlotID) AS plots_count |
|
11 |
FROM projects |
|
12 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
13 |
GROUP BY project |
|
14 |
ORDER BY project |
|
15 |
; |
|
16 |
|
|
17 |
SELECT '# plots' AS ___; |
|
18 |
SELECT count(*) AS count FROM plotMetadata; |
|
19 |
|
|
20 |
SELECT '# plot observations' AS ___; |
|
21 |
SELECT count(*) AS count FROM plotMetadata; |
|
22 |
|
|
23 |
SELECT '1st methods' AS ___; |
|
24 |
SELECT DISTINCT |
|
25 |
CAST(projects.project_id AS char) AS project |
|
26 |
, lookup_MethodCode.Description AS method |
|
27 |
FROM projects |
|
28 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
29 |
JOIN lookup_MethodCode ON lookup_MethodCode.MethodCode = plotMetadata.MethodCode |
|
30 |
ORDER BY project, method |
|
31 |
LIMIT 10; |
|
32 |
|
|
33 |
SELECT '1st method narratives' AS ___; |
|
34 |
SELECT DISTINCT |
|
35 |
CAST(projects.project_id AS char) AS project |
|
36 |
, PlotMethod AS method_narrative |
|
37 |
FROM projects |
|
38 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
39 |
ORDER BY project, method_narrative |
|
40 |
LIMIT 10; |
|
41 |
|
|
42 |
/* |
|
43 |
SELECT p.PlotID, p.SiteCode, COUNT(*) |
|
44 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
45 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
46 |
WHERE p.project_id=2 |
|
47 |
GROUP BY p.PlotID, p.SiteCode; |
|
48 |
|
|
49 |
SELECT NoInd, COUNT(*) AS observations |
|
50 |
FROM plotObservations o JOIN plotMetadata p |
|
51 |
ON o.PlotID=p.PlotID |
|
52 |
WHERE project_id=2 |
|
53 |
GROUP BY NoInd; |
|
54 |
|
|
55 |
SELECT p.PlotID, p.SiteCode, SUM(NoInd) AS Individuals |
|
56 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
57 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
58 |
WHERE p.project_id=2 |
|
59 |
GROUP BY p.PlotID, p.SiteCode; |
|
60 |
|
|
61 |
SELECT DISTINCT pr.project_id, project_name, PlotMethod, m.MethodCode, m.Description |
|
62 |
FROM projects pr JOIN plotMetadata p JOIN lookup_MethodCode m |
|
63 |
ON pr.project_id=p.project_id AND p.MethodCode=m.MethodCode |
|
64 |
WHERE m.MethodCode=8; |
|
65 |
|
|
66 |
SELECT NoInd, COUNT(*) AS observations |
|
67 |
FROM plotObservations o JOIN plotMetadata p JOIN lookup_MethodCode m |
|
68 |
ON o.PlotID=p.PlotID AND p.MethodCode=m.MethodCode |
|
69 |
WHERE project_id=2 |
|
70 |
GROUP BY NoInd; |
|
71 |
|
|
72 |
SELECT p.PlotID, p.SiteCode, SUM(NoInd) AS Individuals |
|
73 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
74 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
75 |
WHERE p.project_id=1 |
|
76 |
GROUP BY p.PlotID, p.SiteCode |
|
77 |
LIMIT 10; |
|
78 |
|
|
79 |
SELECT PlotMethod, MethodCode, Description, COUNT(project_id) as projects |
|
80 |
FROM ( |
|
81 |
SELECT DISTINCT p.PlotMethod, p.MethodCode, p.Description, p.project_id |
|
82 |
FROM ( |
|
83 |
SELECT project_id, PlotID, PlotMethod, m.MethodCode, m.Description |
|
84 |
FROM plotMetadata p JOIN lookup_MethodCode m |
|
85 |
ON p.MethodCode=m.MethodCode |
|
86 |
) p JOIN plotObservations o JOIN stems s |
|
87 |
ON p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
88 |
GROUP BY project_id |
|
89 |
) AS a |
|
90 |
GROUP BY PlotMethod, MethodCode, Description; |
|
91 |
|
|
92 |
SELECT DISTINCT pr.project_id, project_name |
|
93 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o JOIN stems s |
|
94 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
95 |
WHERE p.MethodCode=3; |
|
96 |
|
|
97 |
SELECT p.PlotID, SiteName as plot, COUNT(*) AS stems |
|
98 |
FROM plotMetadata p JOIN plotObservations o JOIN stems s |
|
99 |
ON p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
100 |
WHERE p.project_id=2 |
|
101 |
GROUP BY p.PlotID, SiteName |
|
102 |
LIMIT 10; |
|
103 |
|
|
104 |
SELECT p.PlotID, SiteName AS plot, COUNT(DISTINCT Family, Genus, Species) AS SpeciesCount |
|
105 |
FROM plotMetadata p JOIN plotObservations o |
|
106 |
ON p.PlotID=o.PlotID |
|
107 |
WHERE project_id=2 |
|
108 |
GROUP BY p.PlotID, SiteName; |
|
109 |
|
|
110 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName |
|
111 |
FROM plotMetadata p JOIN plotObservations o |
|
112 |
ON p.PlotID=o.PlotID |
|
113 |
WHERE p.PlotID=298; |
|
114 |
|
|
115 |
SELECT name_status, count(*) FROM plotObservations GROUP BY name_status; |
|
116 |
|
|
117 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, |
|
118 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, name_status |
|
119 |
FROM plotMetadata p JOIN plotObservations o |
|
120 |
ON p.PlotID=o.PlotID |
|
121 |
WHERE p.PlotID=298; |
|
122 |
|
|
123 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, |
|
124 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, name_status |
|
125 |
FROM plotMetadata p JOIN plotObservations o |
|
126 |
ON p.PlotID=o.PlotID |
|
127 |
WHERE p.PlotID=298 AND name_status=1; |
|
128 |
|
|
129 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, COUNT(*) AS individuals |
|
130 |
FROM plotMetadata p JOIN plotObservations o |
|
131 |
ON p.PlotID=o.PlotID |
|
132 |
WHERE p.PlotID=298 |
|
133 |
GROUP BY p.PlotID, plot, subplot; |
|
134 |
|
|
135 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, SUM(NoInd) AS individuals |
|
136 |
FROM plotMetadata p JOIN plotObservations o |
|
137 |
ON p.PlotID=o.PlotID |
|
138 |
WHERE p.PlotID=298 |
|
139 |
GROUP BY p.PlotID, plot, subplot; |
|
140 |
|
|
141 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, SUM(NoInd) AS individuals |
|
142 |
FROM plotMetadata p JOIN plotObservations o |
|
143 |
ON p.PlotID=o.PlotID |
|
144 |
WHERE p.PlotID=1 |
|
145 |
GROUP BY p.PlotID, plot, subplot; |
|
146 |
|
|
147 |
SELECT COUNT(*) FROM plotMetadata WHERE MethodCode=1; |
|
148 |
|
|
149 |
SELECT PlotID FROM plotMetadata WHERE MethodCode=1 LIMIT 1; |
|
150 |
|
|
151 |
SELECT p.PlotID, SiteCode AS plot, Family, |
|
152 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, cover_percent |
|
153 |
FROM plotMetadata p JOIN plotObservations o |
|
154 |
ON p.PlotID=o.PlotID |
|
155 |
WHERE p.PlotID=24589; |
|
156 |
|
|
157 |
SELECT p.PlotID, p.SiteCode as plot, Country, PolDiv1 AS stateProvince, pol2 AS countyParish, |
|
158 |
LatDec as latitude, LongDec as longitude, Elev as elevation |
|
159 |
FROM projects pr JOIN plotMetadata p |
|
160 |
ON pr.project_id=p.project_id |
|
161 |
WHERE pr.project_id=1 |
|
162 |
LIMIT 20; |
|
163 |
|
|
164 |
SELECT AccessCode, COUNT(*) |
|
165 |
FROM plotMetadata |
|
166 |
GROUP BY AccessCode; |
|
167 |
|
|
168 |
SELECT pr.project_id, project_name, project_pi, allow_download_all, PlotID, SiteCode, Country |
|
169 |
FROM projects pr JOIN plotMetadata p |
|
170 |
ON pr.project_id=p.project_id |
|
171 |
WHERE p.AccessCode=1; |
|
172 |
*/ |
inputs/SALVIAS/verify/plots.ref | ||
---|---|---|
1 |
___ |
|
2 |
# projects |
|
3 |
count |
|
4 |
23 |
|
5 |
___ |
|
6 |
projects |
|
7 |
project |
|
8 |
1 |
|
9 |
10 |
|
10 |
11 |
|
11 |
12 |
|
12 |
13 |
|
13 |
14 |
|
14 |
16 |
|
15 |
17 |
|
16 |
18 |
|
17 |
19 |
|
18 |
2 |
|
19 |
21 |
|
20 |
22 |
|
21 |
23 |
|
22 |
24 |
|
23 |
25 |
|
24 |
26 |
|
25 |
3 |
|
26 |
5 |
|
27 |
6 |
|
28 |
7 |
|
29 |
8 |
|
30 |
9 |
|
31 |
___ |
|
32 |
each project's # plots |
|
33 |
project plots_count |
|
34 |
1 228 |
|
35 |
10 22 |
|
36 |
11 12962 |
|
37 |
12 28 |
|
38 |
13 2 |
|
39 |
14 99 |
|
40 |
16 2 |
|
41 |
17 6 |
|
42 |
18 3 |
|
43 |
19 4 |
|
44 |
2 37 |
|
45 |
21 3 |
|
46 |
22 1 |
|
47 |
23 70 |
|
48 |
24 4 |
|
49 |
25 28 |
|
50 |
3 20 |
|
51 |
5 102 |
|
52 |
6 29 |
|
53 |
7 9 |
|
54 |
8 1 |
|
55 |
9 1 |
|
56 |
___ |
|
57 |
# plots |
|
58 |
count |
|
59 |
13661 |
|
60 |
___ |
|
61 |
# plot observations |
|
62 |
count |
|
63 |
13661 |
|
64 |
___ |
|
65 |
1st methods |
|
66 |
project method |
|
67 |
1 species (stems) |
|
68 |
10 individuals |
|
69 |
11 species (percent cover) |
|
70 |
12 individuals |
|
71 |
13 individuals |
|
72 |
14 individuals |
|
73 |
17 individuals |
|
74 |
18 individuals |
|
75 |
19 individuals |
|
76 |
2 individuals |
|
77 |
___ |
|
78 |
1st method narratives |
|
79 |
project method_narrative |
|
80 |
1 0.1 ha transect, stems >= 2.5 cm dbh |
|
81 |
10 NULL |
|
82 |
10 "Pseudotransect": collection of leaf samples from species recorded in previous 0.1 ha transect. Species sampled from same location as previous transect "c2750-1" (project "Boyle Transects"); do not necessarily correspond to same individuals. |
|
83 |
10 "Pseudotransect": collection of leaf samples from species recorded in previous 0.1 ha transect. Species sampled from same location as previous transect "Savegre1" (project "OTS Transects"); do not necessarily correspond to same individuals. |
|
84 |
10 0.1 ha transect, stems >= 2.5 cm dbh |
|
85 |
11 20 m x 20 cover plots, all vascular plants |
|
86 |
12 0.01 ha, stems >= 10 cm dbh; 16 subplots of 10 x 10 m per plot, 4 rows (UU, U, S, SS), 4 columns (BB, B, T, TT) |
|
87 |
13 1 ha, stems >= 10 cm dbh |
|
88 |
14 0.1 ha transect, stems >= 2.5 cm dbh |
|
89 |
16 NULL |
inputs/SALVIAS/verify/plots.sql | ||
---|---|---|
1 |
SELECT '# projects' AS ___; |
|
2 |
SELECT count(*) AS count FROM project; |
|
3 |
|
|
4 |
SELECT 'projects' AS ___; |
|
5 |
SELECT projectname AS project FROM project ORDER BY project; |
|
6 |
|
|
7 |
SELECT E'each project\'s # plots' AS ___; |
|
8 |
SELECT projectname AS project, count(*) AS plots_count |
|
9 |
FROM project |
|
10 |
JOIN plotevent USING (project_id) |
|
11 |
GROUP BY project |
|
12 |
ORDER BY project |
|
13 |
; |
|
14 |
|
|
15 |
SELECT '# plots' AS ___; |
|
16 |
SELECT count(*) AS count FROM plot; |
|
17 |
|
|
18 |
SELECT '# plot observations' AS ___; |
|
19 |
SELECT count(*) AS count FROM plotevent; |
|
20 |
|
|
21 |
SELECT '1st methods' AS ___; |
|
22 |
SELECT DISTINCT |
|
23 |
projectname AS project |
|
24 |
, stemSampleMethod AS method -- placeholder until we have a method field |
|
25 |
FROM project |
|
26 |
JOIN plotevent USING (project_id) |
|
27 |
ORDER BY project, method |
|
28 |
LIMIT 10; |
|
29 |
|
|
30 |
SELECT '1st method narratives' AS ___; |
|
31 |
SELECT DISTINCT |
|
32 |
projectname AS project |
|
33 |
, methodNarrative AS method_narrative |
|
34 |
FROM project |
|
35 |
JOIN plotevent USING (project_id) |
|
36 |
ORDER BY project, method_narrative |
|
37 |
LIMIT 10; |
inputs/SALVIAS/verify.ref | ||
---|---|---|
1 |
___ |
|
2 |
# projects |
|
3 |
count |
|
4 |
23 |
|
5 |
___ |
|
6 |
projects |
|
7 |
project |
|
8 |
1 |
|
9 |
10 |
|
10 |
11 |
|
11 |
12 |
|
12 |
13 |
|
13 |
14 |
|
14 |
16 |
|
15 |
17 |
|
16 |
18 |
|
17 |
19 |
|
18 |
2 |
|
19 |
21 |
|
20 |
22 |
|
21 |
23 |
|
22 |
24 |
|
23 |
25 |
|
24 |
26 |
|
25 |
3 |
|
26 |
5 |
|
27 |
6 |
|
28 |
7 |
|
29 |
8 |
|
30 |
9 |
|
31 |
___ |
|
32 |
each project's # plots |
|
33 |
project plots_count |
|
34 |
1 228 |
|
35 |
10 22 |
|
36 |
11 12962 |
|
37 |
12 28 |
|
38 |
13 2 |
|
39 |
14 99 |
|
40 |
16 2 |
|
41 |
17 6 |
|
42 |
18 3 |
|
43 |
19 4 |
|
44 |
2 37 |
|
45 |
21 3 |
|
46 |
22 1 |
|
47 |
23 70 |
|
48 |
24 4 |
|
49 |
25 28 |
|
50 |
3 20 |
|
51 |
5 102 |
|
52 |
6 29 |
|
53 |
7 9 |
|
54 |
8 1 |
|
55 |
9 1 |
|
56 |
___ |
|
57 |
# plots |
|
58 |
count |
|
59 |
13661 |
|
60 |
___ |
|
61 |
# plot observations |
|
62 |
count |
|
63 |
13661 |
|
64 |
___ |
|
65 |
1st methods |
|
66 |
project method |
|
67 |
1 species (stems) |
|
68 |
10 individuals |
|
69 |
11 species (percent cover) |
|
70 |
12 individuals |
|
71 |
13 individuals |
|
72 |
14 individuals |
|
73 |
17 individuals |
|
74 |
18 individuals |
|
75 |
19 individuals |
|
76 |
2 individuals |
|
77 |
___ |
|
78 |
1st method narratives |
|
79 |
project method_narrative |
|
80 |
1 0.1 ha transect, stems >= 2.5 cm dbh |
|
81 |
10 NULL |
|
82 |
10 "Pseudotransect": collection of leaf samples from species recorded in previous 0.1 ha transect. Species sampled from same location as previous transect "c2750-1" (project "Boyle Transects"); do not necessarily correspond to same individuals. |
|
83 |
10 "Pseudotransect": collection of leaf samples from species recorded in previous 0.1 ha transect. Species sampled from same location as previous transect "Savegre1" (project "OTS Transects"); do not necessarily correspond to same individuals. |
|
84 |
10 0.1 ha transect, stems >= 2.5 cm dbh |
|
85 |
11 20 m x 20 cover plots, all vascular plants |
|
86 |
12 0.01 ha, stems >= 10 cm dbh; 16 subplots of 10 x 10 m per plot, 4 rows (UU, U, S, SS), 4 columns (BB, B, T, TT) |
|
87 |
13 1 ha, stems >= 10 cm dbh |
|
88 |
14 0.1 ha transect, stems >= 2.5 cm dbh |
|
89 |
16 NULL |
inputs/SALVIAS/verify.sql | ||
---|---|---|
1 |
SELECT '# projects' AS ___; |
|
2 |
SELECT count(*) AS count FROM project; |
|
3 |
|
|
4 |
SELECT 'projects' AS ___; |
|
5 |
SELECT projectname AS project FROM project ORDER BY project; |
|
6 |
|
|
7 |
SELECT E'each project\'s # plots' AS ___; |
|
8 |
SELECT projectname AS project, count(*) AS plots_count |
|
9 |
FROM project |
|
10 |
JOIN plotevent USING (project_id) |
|
11 |
GROUP BY project |
|
12 |
ORDER BY project |
|
13 |
; |
|
14 |
|
|
15 |
SELECT '# plots' AS ___; |
|
16 |
SELECT count(*) AS count FROM plot; |
|
17 |
|
|
18 |
SELECT '# plot observations' AS ___; |
|
19 |
SELECT count(*) AS count FROM plotevent; |
|
20 |
|
|
21 |
SELECT '1st methods' AS ___; |
|
22 |
SELECT DISTINCT |
|
23 |
projectname AS project |
|
24 |
, stemSampleMethod AS method -- placeholder until we have a method field |
|
25 |
FROM project |
|
26 |
JOIN plotevent USING (project_id) |
|
27 |
ORDER BY project, method |
|
28 |
LIMIT 10; |
|
29 |
|
|
30 |
SELECT '1st method narratives' AS ___; |
|
31 |
SELECT DISTINCT |
|
32 |
projectname AS project |
|
33 |
, methodNarrative AS method_narrative |
|
34 |
FROM project |
|
35 |
JOIN plotevent USING (project_id) |
|
36 |
ORDER BY project, method_narrative |
|
37 |
LIMIT 10; |
inputs/SALVIAS/verify.ref.sql | ||
---|---|---|
1 |
SELECT '# projects' AS ___; |
|
2 |
SELECT count(*) AS count FROM projects; |
|
3 |
|
|
4 |
SELECT 'projects' AS ___; |
|
5 |
SELECT CAST(project_id AS char) AS project FROM projects ORDER BY project; |
|
6 |
|
|
7 |
SELECT 'each project\'s # plots' AS ___; |
|
8 |
SELECT |
|
9 |
CAST(projects.project_id AS char) AS project |
|
10 |
, count(PlotID) AS plots_count |
|
11 |
FROM projects |
|
12 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
13 |
GROUP BY project |
|
14 |
ORDER BY project |
|
15 |
; |
|
16 |
|
|
17 |
SELECT '# plots' AS ___; |
|
18 |
SELECT count(*) AS count FROM plotMetadata; |
|
19 |
|
|
20 |
SELECT '# plot observations' AS ___; |
|
21 |
SELECT count(*) AS count FROM plotMetadata; |
|
22 |
|
|
23 |
SELECT '1st methods' AS ___; |
|
24 |
SELECT DISTINCT |
|
25 |
CAST(projects.project_id AS char) AS project |
|
26 |
, lookup_MethodCode.Description AS method |
|
27 |
FROM projects |
|
28 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
29 |
JOIN lookup_MethodCode ON lookup_MethodCode.MethodCode = plotMetadata.MethodCode |
|
30 |
ORDER BY project, method |
|
31 |
LIMIT 10; |
|
32 |
|
|
33 |
SELECT '1st method narratives' AS ___; |
|
34 |
SELECT DISTINCT |
|
35 |
CAST(projects.project_id AS char) AS project |
|
36 |
, PlotMethod AS method_narrative |
|
37 |
FROM projects |
|
38 |
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id |
|
39 |
ORDER BY project, method_narrative |
|
40 |
LIMIT 10; |
|
41 |
|
|
42 |
/* |
|
43 |
SELECT p.PlotID, p.SiteCode, COUNT(*) |
|
44 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
45 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
46 |
WHERE p.project_id=2 |
|
47 |
GROUP BY p.PlotID, p.SiteCode; |
|
48 |
|
|
49 |
SELECT NoInd, COUNT(*) AS observations |
|
50 |
FROM plotObservations o JOIN plotMetadata p |
|
51 |
ON o.PlotID=p.PlotID |
|
52 |
WHERE project_id=2 |
|
53 |
GROUP BY NoInd; |
|
54 |
|
|
55 |
SELECT p.PlotID, p.SiteCode, SUM(NoInd) AS Individuals |
|
56 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
57 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
58 |
WHERE p.project_id=2 |
|
59 |
GROUP BY p.PlotID, p.SiteCode; |
|
60 |
|
|
61 |
SELECT DISTINCT pr.project_id, project_name, PlotMethod, m.MethodCode, m.Description |
|
62 |
FROM projects pr JOIN plotMetadata p JOIN lookup_MethodCode m |
|
63 |
ON pr.project_id=p.project_id AND p.MethodCode=m.MethodCode |
|
64 |
WHERE m.MethodCode=8; |
|
65 |
|
|
66 |
SELECT NoInd, COUNT(*) AS observations |
|
67 |
FROM plotObservations o JOIN plotMetadata p JOIN lookup_MethodCode m |
|
68 |
ON o.PlotID=p.PlotID AND p.MethodCode=m.MethodCode |
|
69 |
WHERE project_id=2 |
|
70 |
GROUP BY NoInd; |
|
71 |
|
|
72 |
SELECT p.PlotID, p.SiteCode, SUM(NoInd) AS Individuals |
|
73 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o |
|
74 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID |
|
75 |
WHERE p.project_id=1 |
|
76 |
GROUP BY p.PlotID, p.SiteCode |
|
77 |
LIMIT 10; |
|
78 |
|
|
79 |
SELECT PlotMethod, MethodCode, Description, COUNT(project_id) as projects |
|
80 |
FROM ( |
|
81 |
SELECT DISTINCT p.PlotMethod, p.MethodCode, p.Description, p.project_id |
|
82 |
FROM ( |
|
83 |
SELECT project_id, PlotID, PlotMethod, m.MethodCode, m.Description |
|
84 |
FROM plotMetadata p JOIN lookup_MethodCode m |
|
85 |
ON p.MethodCode=m.MethodCode |
|
86 |
) p JOIN plotObservations o JOIN stems s |
|
87 |
ON p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
88 |
GROUP BY project_id |
|
89 |
) AS a |
|
90 |
GROUP BY PlotMethod, MethodCode, Description; |
|
91 |
|
|
92 |
SELECT DISTINCT pr.project_id, project_name |
|
93 |
FROM projects pr JOIN plotMetadata p JOIN plotObservations o JOIN stems s |
|
94 |
ON pr.project_id=p.project_id AND p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
95 |
WHERE p.MethodCode=3; |
|
96 |
|
|
97 |
SELECT p.PlotID, SiteName as plot, COUNT(*) AS stems |
|
98 |
FROM plotMetadata p JOIN plotObservations o JOIN stems s |
|
99 |
ON p.PlotID=o.PlotID AND o.PlotObsID=s.PlotObsID |
|
100 |
WHERE p.project_id=2 |
|
101 |
GROUP BY p.PlotID, SiteName |
|
102 |
LIMIT 10; |
|
103 |
|
|
104 |
SELECT p.PlotID, SiteName AS plot, COUNT(DISTINCT Family, Genus, Species) AS SpeciesCount |
|
105 |
FROM plotMetadata p JOIN plotObservations o |
|
106 |
ON p.PlotID=o.PlotID |
|
107 |
WHERE project_id=2 |
|
108 |
GROUP BY p.PlotID, SiteName; |
|
109 |
|
|
110 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName |
|
111 |
FROM plotMetadata p JOIN plotObservations o |
|
112 |
ON p.PlotID=o.PlotID |
|
113 |
WHERE p.PlotID=298; |
|
114 |
|
|
115 |
SELECT name_status, count(*) FROM plotObservations GROUP BY name_status; |
|
116 |
|
|
117 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, |
|
118 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, name_status |
|
119 |
FROM plotMetadata p JOIN plotObservations o |
|
120 |
ON p.PlotID=o.PlotID |
|
121 |
WHERE p.PlotID=298; |
|
122 |
|
|
123 |
SELECT DISTINCT p.PlotID, SiteName AS plot, Family, |
|
124 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, name_status |
|
125 |
FROM plotMetadata p JOIN plotObservations o |
|
126 |
ON p.PlotID=o.PlotID |
|
127 |
WHERE p.PlotID=298 AND name_status=1; |
|
128 |
|
|
129 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, COUNT(*) AS individuals |
|
130 |
FROM plotMetadata p JOIN plotObservations o |
|
131 |
ON p.PlotID=o.PlotID |
|
132 |
WHERE p.PlotID=298 |
|
133 |
GROUP BY p.PlotID, plot, subplot; |
|
134 |
|
|
135 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, SUM(NoInd) AS individuals |
|
136 |
FROM plotMetadata p JOIN plotObservations o |
|
137 |
ON p.PlotID=o.PlotID |
|
138 |
WHERE p.PlotID=298 |
|
139 |
GROUP BY p.PlotID, plot, subplot; |
|
140 |
|
|
141 |
SELECT p.PlotID, SiteCode AS plot, o.Line as subplot, SUM(NoInd) AS individuals |
|
142 |
FROM plotMetadata p JOIN plotObservations o |
|
143 |
ON p.PlotID=o.PlotID |
|
144 |
WHERE p.PlotID=1 |
|
145 |
GROUP BY p.PlotID, plot, subplot; |
|
146 |
|
|
147 |
SELECT COUNT(*) FROM plotMetadata WHERE MethodCode=1; |
|
148 |
|
|
149 |
SELECT PlotID FROM plotMetadata WHERE MethodCode=1 LIMIT 1; |
|
150 |
|
|
151 |
SELECT p.PlotID, SiteCode AS plot, Family, |
|
152 |
CONCAT_WS(' ',IFNULL(Genus,''), IFNULL(Species,'')) AS SpeciesName, cover_percent |
|
153 |
FROM plotMetadata p JOIN plotObservations o |
|
154 |
ON p.PlotID=o.PlotID |
|
155 |
WHERE p.PlotID=24589; |
|
156 |
|
|
157 |
SELECT p.PlotID, p.SiteCode as plot, Country, PolDiv1 AS stateProvince, pol2 AS countyParish, |
|
158 |
LatDec as latitude, LongDec as longitude, Elev as elevation |
|
159 |
FROM projects pr JOIN plotMetadata p |
|
160 |
ON pr.project_id=p.project_id |
|
161 |
WHERE pr.project_id=1 |
|
162 |
LIMIT 20; |
|
163 |
|
|
164 |
SELECT AccessCode, COUNT(*) |
|
165 |
FROM plotMetadata |
|
166 |
GROUP BY AccessCode; |
|
167 |
|
|
168 |
SELECT pr.project_id, project_name, project_pi, allow_download_all, PlotID, SiteCode, Country |
|
169 |
FROM projects pr JOIN plotMetadata p |
|
170 |
ON pr.project_id=p.project_id |
|
171 |
WHERE p.AccessCode=1; |
|
172 |
*/ |
inputs/input.Makefile | ||
---|---|---|
69 | 69 |
|
70 | 70 |
##### |
71 | 71 |
|
72 |
verify: _always $(addprefix verify-,$(tables)) ; |
|
73 |
|
|
74 |
verify-%: verify/%.ref verify/%.out _always |
|
72 |
verify: verify.ref verify.out _always |
|
75 | 73 |
$(DIFF) $(+_) |
76 | 74 |
|
75 |
all += verify.out |
|
76 |
|
|
77 | 77 |
%.out: %.sql _always |
78 | 78 |
$(out_cmd) |
79 | 79 |
.PRECIOUS: %.out |
80 | 80 |
out_cmd = $(psqlAsBien) --no-align --field-separator=' ' --pset=footer=off \ |
81 | 81 |
--pset=null=NULL <$< >$@ |
82 | 82 |
|
83 |
all += $(wildcard verify/*.out) |
|
84 |
|
|
85 | 83 |
##### |
86 | 84 |
|
87 | 85 |
test: test.out _always |
Also available in: Unified diff
input.Makefile: Moved verifications into one set of verify.* files