clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 497290 fiddles created (9518 in the last week).

select @@version;
@@version
10.2.19-MariaDB-10.2.19+maria~jessie-log
 hidden batch(es)


CREATE TABLE `activities` ( `id` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `user_id` int(10) UNSIGNED DEFAULT NULL, `device_id` int(10) UNSIGNED DEFAULT NULL, `kind_id` int(10) UNSIGNED DEFAULT NULL, `country_id` int(10) UNSIGNED DEFAULT NULL, `province_id` int(10) UNSIGNED DEFAULT NULL, `started_at` timestamp NULL DEFAULT NULL, `finished_at` timestamp NULL DEFAULT NULL, `calories` double DEFAULT NULL, `value` double DEFAULT NULL, `score` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 hidden batch(es)


SET @@session.time_zone = '+00:00';
 hidden batch(es)


INSERT INTO `activities` (`id`, `created_at`, `updated_at`, `deleted_at`, `user_id`, `device_id`, `kind_id`, `country_id`, `province_id`, `started_at`, `finished_at`, `calories`, `value`, `score`) VALUES (1, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-18 20:30:00', '2019-02-18 21:09:39', 0, 1, 5), (2, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-18 22:30:00', '2019-02-18 23:02:36', 0, 31, 155), (3, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-18 23:30:00', '2019-02-19 00:01:19', 0, 6, 30), (4, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 06:30:00', '2019-02-19 07:29:39', 0, 33, 165), (5, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 07:30:00', '2019-02-19 08:29:25', 0, 76, 380), (6, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 08:30:00', '2019-02-19 08:58:56', 0, 5, 25), (7, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 09:30:00', '2019-02-19 09:37:58', 0, 9, 45), (8, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 10:30:00', '2019-02-19 11:23:47', 0, 8, 40), (9, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 11:30:00', '2019-02-19 11:52:42', 0, 14, 70), (10, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 13:30:00', '2019-02-19 14:12:46', 0, 7, 35), (11, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 14:30:00', '2019-02-19 14:56:05', 0, 9, 45), (12, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 15:30:00', '2019-02-19 16:21:02', 0, 2, 10), (13, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 16:30:00', '2019-02-19 17:11:10', 0, 5, 25), (14, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 17:30:00', '2019-02-19 18:01:52', 0, 7, 35), (15, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 18:30:00', '2019-02-19 19:00:40', 0, 2, 10), (16, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-19 19:30:00', '2019-02-19 20:08:42', 0, 4, 20), (17, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-23 20:30:00', '2019-02-23 20:57:17', 0, 1, 5), (18, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-23 21:30:00', '2019-02-23 22:13:50', 0, 32, 160), (19, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 02:30:00', '2019-02-24 03:28:27', 0, 1, 5), (20, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 03:30:00', '2019-02-24 03:30:20', 0, 1, 5), (21, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 06:30:00', '2019-02-24 07:09:16', 0, 45, 225), (22, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 07:30:00', '2019-02-24 07:58:21', 0, 17, 85), (23, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 09:30:00', '2019-02-24 10:06:27', 0, 18, 90), (24, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 11:30:00', '2019-02-24 12:27:45', 0, 1, 5), (25, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 14:30:00', '2019-02-24 15:02:17', 0, 2, 10), (26, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 15:30:00', '2019-02-24 15:54:34', 0, 1, 5), (27, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 16:30:00', '2019-02-24 17:25:51', 0, 38, 190), (28, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 17:30:00', '2019-02-24 18:21:19', 0, 27, 135), (29, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 18:30:00', '2019-02-24 19:08:06', 0, 8, 40), (30, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 20:30:00', '2019-02-24 20:58:38', 0, 4, 20), (31, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 21:30:00', '2019-02-24 22:26:47', 0, 2, 10), (32, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-24 22:30:00', '2019-02-24 23:21:29', 0, 6, 30), (33, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-25 05:30:00', '2019-02-25 06:28:55', 0, 6, 30), (34, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-25 06:30:00', '2019-02-25 07:28:19', 0, 43, 215), (35, '2019-03-02 08:24:44', '2019-03-02 08:24:44', NULL, 1, 1, 201, 1, 3, '2019-02-25 07:30:00', '2019-02-25 08:20:08', 0, 55, 275), (36, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 11:30:00', '2019-02-25 12:03:56', 0, 46, 230), (37, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 14:30:00', '2019-02-25 15:00:41', 0, 2, 10), (38, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 15:30:00', '2019-02-25 16:29:59', 0, 8, 40), (39, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 16:30:00', '2019-02-25 17:23:14', 0, 78, 390), (40, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 17:30:00', '2019-02-25 18:17:57', 0, 96, 480), (41, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 18:30:00', '2019-02-25 19:06:46', 0, 5, 25), (42, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-25 21:30:00', '2019-02-25 21:44:42', 0, 3, 15), (43, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 02:30:00', '2019-02-26 02:49:32', 0, 11, 55), (44, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 05:30:00', '2019-02-26 06:16:41', 0, 50, 250), (45, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 06:30:00', '2019-02-26 07:26:10', 0, 19, 95), (46, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 07:30:00', '2019-02-26 08:14:00', 0, 111, 555), (47, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 08:30:00', '2019-02-26 08:56:43', 0, 1, 5), (48, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 09:30:00', '2019-02-26 10:04:22', 0, 3, 15), (49, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 11:30:00', '2019-02-26 12:06:39', 0, 14, 70), (50, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 12:30:00', '2019-02-26 12:38:12', 0, 25, 125), (51, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 14:30:00', '2019-02-26 14:52:40', 0, 1, 5), (52, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 15:30:00', '2019-02-26 16:00:49', 0, 7, 35), (53, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 17:30:00', '2019-02-26 18:29:54', 0, 101, 505), (54, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 18:30:00', '2019-02-26 19:05:05', 0, 52, 260), (55, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 19:30:00', '2019-02-26 20:29:52', 0, 104, 520), (56, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 20:30:00', '2019-02-26 21:26:39', 0, 51, 255), (57, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-26 21:30:00', '2019-02-26 21:30:37', 0, 7, 35), (58, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 02:30:00', '2019-02-27 03:13:30', 0, 38, 190), (59, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 03:30:00', '2019-02-27 04:28:15', 0, 3, 15), (60, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 04:30:00', '2019-02-27 05:18:19', 0, 11, 55), (61, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 05:30:00', '2019-02-27 06:27:00', 0, 17, 85), (62, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 06:30:00', '2019-02-27 06:46:48', 0, 12, 60), (63, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 07:30:00', '2019-02-27 08:29:48', 0, 379, 1895), (64, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 08:30:00', '2019-02-27 09:26:30', 0, 139, 695), (65, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 09:30:00', '2019-02-27 10:28:06', 0, 1, 5), (66, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 14:30:00', '2019-02-27 15:28:07', 0, 229, 1145), (67, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 15:30:00', '2019-02-27 16:29:58', 0, 741, 3705), (68, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 16:30:00', '2019-02-27 17:29:56', 0, 734, 3670), (69, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 17:30:00', '2019-02-27 18:16:03', 0, 219, 1095), (70, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 18:30:00', '2019-02-27 19:29:58', 0, 756, 3780), (71, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 19:30:00', '2019-02-27 19:46:53', 0, 49, 245), (72, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-27 20:30:00', '2019-02-27 20:59:01', 0, 20, 100), (73, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 00:30:00', '2019-02-28 01:28:38', 0, 11, 55), (74, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 06:30:00', '2019-02-28 07:29:02', 0, 91, 455), (75, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 07:30:00', '2019-02-28 08:29:35', 0, 192, 960), (76, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 08:30:00', '2019-02-28 09:29:59', 0, 318, 1590), (77, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 09:30:00', '2019-02-28 10:26:00', 0, 48, 240), (78, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 10:30:00', '2019-02-28 11:22:30', 0, 14, 70), (79, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 11:30:00', '2019-02-28 12:29:04', 0, 19, 95), (80, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 12:30:00', '2019-02-28 13:05:18', 0, 6, 30), (81, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 14:30:00', '2019-02-28 15:24:36', 0, 6, 30), (82, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 15:30:00', '2019-02-28 16:26:52', 0, 22, 110), (83, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 16:30:00', '2019-02-28 17:27:38', 0, 48, 240), (84, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 17:30:00', '2019-02-28 18:21:06', 0, 16, 80), (85, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-02-28 18:30:00', '2019-02-28 19:08:01', 0, 6, 30), (86, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 02:30:00', '2019-03-01 03:24:12', 0, 16, 80), (87, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 06:30:00', '2019-03-01 07:18:31', 0, 10, 50), (88, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 07:30:00', '2019-03-01 08:29:09', 0, 39, 195), (89, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 08:30:00', '2019-03-01 08:57:58', 0, 41, 205), (90, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 09:30:00', '2019-03-01 10:29:56', 0, 23, 115), (91, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 10:30:00', '2019-03-01 10:30:10', 0, 1, 5), (92, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 14:30:00', '2019-03-01 15:24:45', 0, 7, 35), (93, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 16:30:00', '2019-03-01 16:43:49', 0, 14, 70), (94, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 201, 1, 3, '2019-03-01 22:30:00', '2019-03-01 22:55:54', 0, 13, 65), (95, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-19 20:30:00', '2019-02-19 20:08:54', 0, 0, 0), (96, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-23 20:30:00', '2019-02-23 19:58:58', 0, 0, 0), (97, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-24 20:30:00', '2019-02-24 18:30:02', 0, 426, 426), (98, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-25 20:30:00', '2019-02-25 18:30:01', 0, 521, 521), (99, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-26 20:30:00', '2019-02-26 18:30:01', 0, 525, 525), (100, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-27 20:30:00', '2019-02-27 18:30:02', 0, 385, 385), (101, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-02-28 20:30:00', '2019-02-28 18:30:03', 0, 217, 217), (102, '2019-03-02 08:24:45', '2019-03-02 08:24:45', NULL, 1, 1, 101, 1, 3, '2019-03-01 20:30:00', '2019-03-01 18:30:00', 0, 313, 313), (103, '2019-03-02 14:11:25', '2019-03-02 14:11:25', NULL, 4, 3, 201, 1, 4, '2019-03-02 12:30:00', '2019-03-02 13:22:48', 0, 1, 5), (104, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 201, 1, 4, '2019-03-02 14:30:00', '2019-03-02 15:29:17', 0, 193, 965), (105, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 201, 1, 4, '2019-03-02 15:30:00', '2019-03-02 16:29:57', 0, 126, 630), (106, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 201, 1, 4, '2019-03-02 16:30:00', '2019-03-02 17:24:30', 0, 184, 920), (107, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 201, 1, 4, '2019-03-02 17:30:00', '2019-03-02 18:23:47', 0, 488, 2440), (108, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 201, 1, 4, '2019-03-02 18:30:00', '2019-03-02 19:27:26', 0, 5, 25), (109, '2019-03-02 20:08:45', '2019-03-02 20:08:45', NULL, 4, 4, 101, 1, 4, '2019-03-01 20:30:00', '2019-03-02 18:30:00', 0, 0, 0), (110, '2019-03-02 20:12:02', '2019-03-02 20:12:02', NULL, 4, 4, 401, 1, 4, '2019-03-01 20:30:00', '1970-01-01 00:10:25', 0, 1, 2), (111, '2019-03-02 20:12:02', '2019-03-02 20:12:02', NULL, 4, 4, 402, 1, 4, '2019-03-01 20:30:00', '1970-01-01 00:43:20', 0, 1, 2), (112, '2019-03-02 20:12:02', '2019-03-02 20:12:02', NULL, 4, 4, 403, 1, 4, '2019-03-01 20:30:00', '1970-01-01 00:33:20', 0, 1, 2), (113, '2019-03-02 20:12:02', '2019-03-02 20:12:02', NULL, 4, 4, 404, 1, 4, '2019-03-01 20:30:00', '1970-01-01 00:07:10', 0, 1, 2), (114, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-02 19:30:00', '2019-03-02 20:09:26', 0, 5, 25), (115, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-02 22:30:00', '2019-03-02 23:25:16', 0, 14, 70), (116, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-02 23:30:00', '2019-03-02 23:40:17', 0, 15, 75), (117, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-03 05:30:00', '2019-03-03 06:20:59', 0, 44, 220), (118, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-03 07:30:00', '2019-03-03 08:18:21', 0, 4, 20), (119, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-03 10:30:00', '2019-03-03 11:26:50', 0, 3, 15), (120, '2019-03-03 13:04:10', '2019-03-03 13:04:10', NULL, 4, 4, 201, 1, 4, '2019-03-03 11:30:00', '2019-03-03 12:22:07', 0, 15, 75), (121, '2019-03-03 13:09:52', '2019-03-03 13:09:52', NULL, 4, 4, 401, 1, 4, '2019-03-02 20:30:00', '1970-01-01 00:14:35', 0, 1, 2), (122, '2019-03-03 13:09:52', '2019-03-03 13:09:52', NULL, 4, 4, 403, 1, 4, '2019-03-02 20:30:00', '1970-01-01 00:20:00', 0, 1, 2), (123, '2019-03-03 13:47:10', '2019-03-03 13:47:10', NULL, 4, 4, 201, 1, 4, '2019-03-03 12:30:00', '2019-03-03 13:06:27', 0, 13, 65), (124, '2019-03-03 13:50:56', '2019-03-03 13:50:56', NULL, 4, 4, 201, 1, 4, '2019-03-03 12:30:00', '2019-03-03 13:06:27', 0, 13, 65), (125, '2019-03-03 14:33:51', '2019-03-03 14:33:51', NULL, 4, 4, 201, 1, 4, '2019-03-03 13:30:00', '2019-03-03 14:25:13', 0, 6, 30), (126, '2019-03-03 15:49:55', '2019-03-03 15:49:55', NULL, 4, 4, 201, 1, 4, '2019-03-03 14:30:00', '2019-03-03 15:16:14', 0, 8, 40), (127, '2019-03-04 17:17:44', '2019-03-04 17:17:44', NULL, 1, 1, 401, 1, 3, '2019-03-03 20:30:00', '1970-01-01 00:35:25', 0, 1, 2), (128, '2019-03-04 17:18:39', '2019-03-04 17:18:39', NULL, 1, 1, 403, 1, 3, '2019-03-03 20:30:00', '1970-01-01 00:50:00', 0, 1, 2), (129, '2019-03-04 17:20:11', '2019-03-04 17:20:11', NULL, 1, 1, 404, 1, 3, '2019-03-03 20:30:00', '1970-01-01 00:08:45', 0, 1, 2), (130, '2019-03-04 17:21:07', '2019-03-04 17:21:07', NULL, 1, 1, 307, 1, 3, '2019-03-03 20:30:00', '2019-03-04 17:22:04', 0, 3, 0), (131, '2019-03-04 17:29:45', '2019-03-04 17:29:45', NULL, 1, 1, 201, 1, 3, '2019-03-04 16:30:00', '2019-03-04 17:14:07', 0, 1, 5), (132, '2019-03-04 17:29:45', '2019-03-04 17:29:45', NULL, 1, 1, 308, 1, 3, '2019-03-03 20:30:00', '2019-03-04 17:30:42', 0, 5, 0), (133, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 201, 1, 9, '2019-03-04 17:30:00', '2019-03-04 18:10:19', 0, 54, 270), (134, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 201, 1, 9, '2019-03-04 18:30:00', '2019-03-04 19:12:06', 0, 32, 160), (135, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 401, 1, 9, '2019-03-04 20:30:00', '2019-03-04 20:58:40', 0, 775, 1550), (136, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 402, 1, 9, '2019-03-04 20:30:00', '2019-03-04 20:58:40', 0, 0, 0), (137, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 403, 1, 9, '2019-03-04 20:30:00', '2019-03-04 20:58:40', 0, 0, 0), (138, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 404, 1, 9, '2019-03-04 20:30:00', '2019-03-04 20:58:40', 0, 0, 0), (139, '2019-03-04 20:57:43', '2019-03-04 20:57:43', NULL, 12, 1, 101, 1, 9, '2019-03-03 20:30:00', '2019-03-04 18:30:01', 0, 0, 0), (140, '2019-03-04 21:49:36', '2019-03-04 21:49:36', NULL, 13, 28, 401, 1, 2, '2019-03-04 20:30:00', '2019-03-04 21:50:33', 0, 1250, 2500), (141, '2019-03-04 21:49:36', '2019-03-04 21:49:36', NULL, 13, 28, 402, 1, 2, '2019-03-04 20:30:00', '2019-03-04 21:50:33', 0, 0, 0), (142, '2019-03-04 21:49:36', '2019-03-04 21:49:36', NULL, 13, 28, 403, 1, 2, '2019-03-04 20:30:00', '2019-03-04 21:50:33', 0, 0, 0), (143, '2019-03-04 21:49:36', '2019-03-04 21:49:36', NULL, 13, 28, 404, 1, 2, '2019-03-04 20:30:00', '2019-03-04 21:50:33', 0, 0, 0), (144, '2019-03-04 21:58:33', '2019-03-04 21:58:33', NULL, 14, 29, 401, 1, 21, '2019-03-04 20:30:00', '2019-03-04 21:59:31', 0, 1500, 3000), (145, '2019-03-04 22:00:18', '2019-03-04 22:00:18', NULL, 14, 29, 403, 1, 21, '2019-03-04 20:30:00', '2019-03-04 22:01:16', 0, 750, 1500), (146, '2019-03-04 22:00:18', '2019-03-04 22:00:18', NULL, 14, 29, 404, 1, 21, '2019-03-04 20:30:00', '2019-03-04 22:01:16', 0, 200, 400), (147, '2019-03-04 22:02:19', '2019-03-04 22:02:19', NULL, 14, 29, 402, 1, 21, '2019-03-04 20:30:00', '2019-03-04 22:03:16', 0, 250, 500), (148, '2019-03-04 22:11:49', '2019-03-04 22:11:49', NULL, 14, 29, 306, 1, 21, '2019-03-04 20:30:00', '2019-03-04 22:12:46', 0, 4, 0), (149, '2019-03-04 22:57:53', '2019-03-04 22:57:53', NULL, 14, 30, 305, 1, 21, '2019-03-04 20:30:00', '2019-03-04 22:58:50', 0, 4, 0), (150, '2019-03-05 05:29:18', '2019-03-05 05:29:18', NULL, 14, 30, 201, 1, 21, '2019-03-04 22:30:00', '2019-03-04 23:29:58', 0, 4, 20), (151, '2019-03-05 05:29:18', '2019-03-05 05:29:18', NULL, 14, 30, 201, 1, 21, '2019-03-04 23:30:00', '2019-03-04 23:30:18', 0, 5, 25), (152, '2019-03-05 05:29:18', '2019-03-05 05:29:18', NULL, 14, 30, 201, 1, 21, '2019-03-05 04:30:00', '2019-03-05 05:29:53', 0, 33, 165), (153, '2019-03-05 07:00:43', '2019-03-05 07:00:43', NULL, 14, 30, 201, 1, 21, '2019-03-05 05:30:00', '2019-03-05 06:05:49', 0, 22, 110), (154, '2019-03-05 08:28:59', '2019-03-05 08:28:59', NULL, 14, 30, 201, 1, 21, '2019-03-05 06:30:00', '2019-03-05 07:18:03', 0, 4, 20), (155, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 07:30:00', '2019-03-05 08:29:45', 0, 141, 705), (156, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 08:30:00', '2019-03-05 09:09:56', 0, 74, 370), (157, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 09:30:00', '2019-03-05 10:29:59', 0, 636, 3180), (158, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 10:30:00', '2019-03-05 11:25:32', 0, 1612, 8060), (159, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 11:30:00', '2019-03-05 11:34:30', 0, 3, 15), (160, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 13:30:00', '2019-03-05 14:29:49', 0, 1, 5), (161, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 14:30:00', '2019-03-05 15:29:56', 0, 85, 425), (162, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 15:30:00', '2019-03-05 16:29:41', 0, 135, 675), (163, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 16:30:00', '2019-03-05 17:28:55', 0, 245, 1225), (164, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 17:30:00', '2019-03-05 18:24:38', 0, 157, 785), (165, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 201, 1, 21, '2019-03-05 19:30:00', '2019-03-05 20:22:02', 0, 1, 5), (166, '2019-03-05 21:19:38', '2019-03-05 21:19:38', NULL, 14, 30, 101, 1, 21, '2019-03-04 20:30:00', '2019-03-05 20:23:01', 0, 295, 295), (167, '2019-03-05 21:42:02', '2019-03-05 21:42:02', NULL, 14, 30, 201, 1, 21, '2019-03-05 20:30:00', '2019-03-05 21:03:51', 0, 8, 40), (168, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-05 21:30:00', '2019-03-05 22:08:17', 0, 25, 125), (169, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-05 22:30:00', '2019-03-05 22:53:33', 0, 7, 35), (170, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-05 23:30:00', '2019-03-06 00:07:02', 0, 6, 30), (171, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-06 04:30:00', '2019-03-06 05:29:39', 0, 15, 75), (172, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-06 05:30:00', '2019-03-06 05:52:02', 0, 2, 10), (173, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-06 06:30:00', '2019-03-06 07:24:10', 0, 198, 990), (174, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-06 07:30:00', '2019-03-06 07:47:53', 0, 67, 335), (175, '2019-03-06 10:10:39', '2019-03-06 10:10:39', NULL, 14, 36, 201, 1, 21, '2019-03-06 08:30:00', '2019-03-06 08:42:56', 0, 1, 5), (176, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 13:30:00', '2019-03-06 14:23:54', 0, 1, 5), (177, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 14:30:00', '2019-03-06 15:27:51', 0, 3, 15), (178, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 15:30:00', '2019-03-06 16:21:18', 0, 37, 185), (179, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 16:30:00', '2019-03-06 17:17:59', 0, 4, 20), (180, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 17:30:00', '2019-03-06 18:21:56', 0, 44, 220), (181, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 18:30:00', '2019-03-06 19:18:17', 0, 2, 10), (182, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 201, 1, 21, '2019-03-06 21:30:00', '2019-03-06 22:00:06', 0, 15, 75), (183, '2019-03-07 03:06:03', '2019-03-07 03:06:03', NULL, 14, 43, 101, 1, 21, '2019-03-05 20:30:00', '2019-03-06 18:30:11', 0, 0, 0);
 hidden batch(es)


ALTER TABLE `activities` ADD PRIMARY KEY (`id`), ADD KEY `idx_activities_deleted_at` (`deleted_at`);
 hidden batch(es)


SELECT user_id, country_id, province_id, SUM(score) AS total_score, RANK() OVER (ORDER BY SUM(score) DESC) AS rank_total, RANK() OVER (PARTITION BY country_id ORDER BY SUM(score) DESC) AS rank_country, RANK() OVER (PARTITION BY country_id, province_id ORDER BY SUM(score) DESC) AS rank_province FROM activities GROUP BY country_id, province_id, user_id ORDER BY rank_total ;
user_id country_id province_id total_score rank_total rank_country rank_province
1 1 3 30553 1 1 1
14 1 21 23660 2 2 1
4 1 4 5697 3 3 1
13 1 2 2500 4 4 1
12 1 9 1980 5 5 1
 hidden batch(es)