Project

General

Profile

1 373 aaronmk
SELECT '# projects' AS ___;
2 1158 aaronmk
SELECT count(*) AS count
3
FROM project
4 6179 aaronmk
WHERE source_id =
5
    (SELECT source_id FROM source WHERE shortname = :datasource)
6 1158 aaronmk
;
7 368 aaronmk
8 374 aaronmk
SELECT 'projects' AS ___;
9 5982 aaronmk
SELECT projectname
10 1158 aaronmk
FROM project
11 6179 aaronmk
WHERE source_id =
12
    (SELECT source_id FROM source WHERE shortname = :datasource)
13 5982 aaronmk
ORDER BY projectname
14 1158 aaronmk
;
15 371 aaronmk
16 616 aaronmk
SELECT E'each project\'s # locations' AS ___;
17 5982 aaronmk
SELECT projectname, count(*) AS locations_count
18 371 aaronmk
FROM project
19 616 aaronmk
JOIN locationevent USING (project_id)
20 6179 aaronmk
WHERE project.source_id =
21
    (SELECT source_id FROM source WHERE shortname = :datasource)
22 5982 aaronmk
GROUP BY projectname
23
ORDER BY projectname
24 371 aaronmk
;
25 374 aaronmk
26 5999 aaronmk
SELECT '# top-level locations' AS ___;
27 1158 aaronmk
SELECT count(DISTINCT location_id) AS count
28 5975 aaronmk
FROM location
29 6179 aaronmk
WHERE source_id =
30
    (SELECT source_id FROM source WHERE shortname = :datasource)
31 1249 aaronmk
AND parent_id IS NULL -- no subplots
32 1157 aaronmk
;
33 376 aaronmk
34 5999 aaronmk
SELECT '# top-level location events' AS ___;
35 1158 aaronmk
SELECT count(*) AS count
36
FROM locationevent
37 6179 aaronmk
WHERE source_id =
38
    (SELECT source_id FROM source WHERE shortname = :datasource)
39 1158 aaronmk
AND parent_id IS NULL -- no subplots
40 1157 aaronmk
;
41 377 aaronmk
42 6001 aaronmk
SELECT '# locations' AS ___;
43
SELECT count(DISTINCT location_id) AS count
44
FROM location
45 6179 aaronmk
WHERE source_id =
46
    (SELECT source_id FROM source WHERE shortname = :datasource)
47 6001 aaronmk
;
48
49
SELECT '# location events' AS ___;
50
SELECT count(*) AS count
51
FROM locationevent
52 6179 aaronmk
WHERE source_id =
53
    (SELECT source_id FROM source WHERE shortname = :datasource)
54 6001 aaronmk
;
55
56 377 aaronmk
SELECT '1st methods' AS ___;
57
SELECT DISTINCT
58 5982 aaronmk
    projectname
59 1156 aaronmk
    , method.name AS method
60 377 aaronmk
FROM project
61 616 aaronmk
JOIN locationevent USING (project_id)
62 1156 aaronmk
JOIN method USING (method_id)
63 6179 aaronmk
WHERE project.source_id =
64
    (SELECT source_id FROM source WHERE shortname = :datasource)
65 5982 aaronmk
ORDER BY projectname, method
66 377 aaronmk
LIMIT 10;
67
68 1083 aaronmk
SELECT '1st observation measures' AS ___;
69 377 aaronmk
SELECT DISTINCT
70 5982 aaronmk
    projectname
71 1083 aaronmk
    , method.observationmeasure AS observationmeasure
72 377 aaronmk
FROM project
73 616 aaronmk
JOIN locationevent USING (project_id)
74 1083 aaronmk
JOIN method USING (method_id)
75 6179 aaronmk
WHERE project.source_id =
76
    (SELECT source_id FROM source WHERE shortname = :datasource)
77 5982 aaronmk
ORDER BY projectname, observationmeasure
78 377 aaronmk
LIMIT 10;