source: trunk/Mars/hawc/processing/software-trigger.sql@ 20026

Last change on this file since 20026 was 20026, checked in by tbretz, 4 years ago
A set of example files for working with the database.
File size: 954 bytes
Line 
1#!/usr/bin/env -S mysql -h ihp-pc45.ethz.ch
2
3CREATE TABLE SoftwareTrigger
4(
5 NIGHT INT UNSIGNED NOT NULL,
6 RUNID MEDIUMINT UNSIGNED NOT NULL,
7 Cnt500 INT UNSIGNED NOT NULL,
8 Cnt750 INT UNSIGNED NOT NULL,
9 Cnt1000 INT UNSIGNED NOT NULL,
10 Cnt1250 INT UNSIGNED NOT NULL,
11 Cnt1500 INT UNSIGNED NOT NULL,
12 Cnt2000 INT UNSIGNED NOT NULL,
13 Cnt5000 INT UNSIGNED NOT NULL,
14 PRIMARY KEY (NIGHT, RUNID)
15)
16AS
17(
18 SELECT
19 NIGHT,
20 RUNID,
21 COUNT(IF(Amplitude>500, 1, NULL)) AS Cnt500,
22 COUNT(IF(Amplitude>750, 1, NULL)) AS Cnt750,
23 COUNT(IF(Amplitude>1000, 1, NULL)) AS Cnt1000,
24 COUNT(IF(Amplitude>1250, 1, NULL)) AS Cnt1250,
25 COUNT(IF(Amplitude>1500, 1, NULL)) AS Cnt1500,
26 COUNT(IF(Amplitude>2000, 1, NULL)) AS Cnt2000,
27 COUNT(IF(Amplitude>5000, 1, NULL)) AS Cnt5000
28 FROM
29 `Callisto`
30 GROUP BY
31 NIGHT,
32 RUNID
33)
Note: See TracBrowser for help on using the repository browser.