1 | #!/usr/bin/env -S mysql -h ihp-pc45.ethz.ch
|
---|
2 |
|
---|
3 | CREATE TABLE SoftwareTrigger
|
---|
4 | (
|
---|
5 | Telescope TINYINT UNSIGNED NOT NULL,
|
---|
6 | NIGHT INT UNSIGNED NOT NULL,
|
---|
7 | RUNID MEDIUMINT UNSIGNED NOT NULL,
|
---|
8 | Cnt500 INT UNSIGNED NOT NULL,
|
---|
9 | Cnt750 INT UNSIGNED NOT NULL,
|
---|
10 | Cnt1000 INT UNSIGNED NOT NULL,
|
---|
11 | Cnt1250 INT UNSIGNED NOT NULL,
|
---|
12 | Cnt1500 INT UNSIGNED NOT NULL,
|
---|
13 | Cnt2000 INT UNSIGNED NOT NULL,
|
---|
14 | Cnt5000 INT UNSIGNED NOT NULL,
|
---|
15 | PRIMARY KEY (Telescope, NIGHT, RUNID)
|
---|
16 | )
|
---|
17 | AS
|
---|
18 | (
|
---|
19 | SELECT
|
---|
20 | Telescope,
|
---|
21 | NIGHT,
|
---|
22 | RUNID,
|
---|
23 | COUNT(IF(Amplitude>500, 1, NULL)) AS Cnt500,
|
---|
24 | COUNT(IF(Amplitude>750, 1, NULL)) AS Cnt750,
|
---|
25 | COUNT(IF(Amplitude>1000, 1, NULL)) AS Cnt1000,
|
---|
26 | COUNT(IF(Amplitude>1250, 1, NULL)) AS Cnt1250,
|
---|
27 | COUNT(IF(Amplitude>1500, 1, NULL)) AS Cnt1500,
|
---|
28 | COUNT(IF(Amplitude>2000, 1, NULL)) AS Cnt2000,
|
---|
29 | COUNT(IF(Amplitude>5000, 1, NULL)) AS Cnt5000
|
---|
30 | FROM
|
---|
31 | `Callisto`
|
---|
32 | GROUP BY
|
---|
33 | Telescope,
|
---|
34 | NIGHT,
|
---|
35 | RUNID
|
---|
36 | ORDER BY
|
---|
37 | Telescope,
|
---|
38 | NIGHT,
|
---|
39 | RUNID
|
---|
40 | )
|
---|