Created
December 31, 2014 20:08
-
-
Save robintw/abc9a33d54c1d40c6f01 to your computer and use it in GitHub Desktop.
SQL for status duration Stack Overflow question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `data` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`set_point` float DEFAULT NULL, | |
`temp` float DEFAULT NULL, | |
`on` tinyint(1) DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
); | |
INSERT INTO `data` (`id`, `timestamp`, `set_point`, `temp`, `on`) | |
VALUES | |
(341, '2014-12-29 07:59:59', 17.5, 12.7, 1), | |
(342, '2014-12-29 08:09:59', 17.5, 12.8, 1), | |
(343, '2014-12-29 08:20:00', 17.5, 12.8, 1), | |
(344, '2014-12-29 08:29:58', 17.5, 12.8, 0), | |
(345, '2014-12-29 08:39:59', 17.5, 12.9, 1), | |
(346, '2014-12-29 08:49:59', 17.5, 12.9, 1), | |
(347, '2014-12-29 08:59:58', 17.5, 12.9, 0), | |
(348, '2014-12-29 09:09:59', 17.5, 13, 0), | |
(349, '2014-12-29 09:19:58', 17.5, 13, 0), | |
(350, '2014-12-29 09:29:59', 17.5, 13.1, 0), | |
(351, '2014-12-29 09:39:58', 16, 13.7, 1), | |
(352, '2014-12-29 09:49:59', 16, 14.1, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment