By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| order_id | customer_id | pizza_id | exclusions | extras | order_time |
|---|---|---|---|---|---|
| 1 | 101 | 1 | 2020-01-01 18:05:02.000 | ||
| 2 | 101 | 1 | 2020-01-01 19:00:52.000 | ||
| 6 | 101 | 2 | null | null | 2020-01-08 21:03:13.000 |
| 3 | 102 | 1 | 2020-01-02 23:51:23.000 | ||
| 3 | 102 | 2 | null | 2020-01-02 23:51:23.000 | |
| 8 | 102 | 1 | null | null | 2020-01-09 23:54:33.000 |
| 4 | 103 | 1 | 4 | 2020-01-04 13:23:46.000 | |
| 4 | 103 | 1 | 4 | 2020-01-04 13:23:46.000 | |
| 4 | 103 | 2 | 4 | 2020-01-04 13:23:46.000 | |
| 9 | 103 | 1 | 4 | 1, 5 | 2020-01-10 11:22:59.000 |
| 5 | 104 | 1 | null | 1 | 2020-01-08 21:00:29.000 |
| 10 | 104 | 1 | null | null | 2020-01-11 18:34:49.000 |
| 10 | 104 | 1 | 2, 6 | 1, 4 | 2020-01-11 18:34:49.000 |
| 7 | 105 | 2 | null | 1 | 2020-01-08 21:20:29.000 |
| order_id | runner_id | pickup_time | distance | duration | cancellation |
|---|---|---|---|---|---|
| 1 | 1 | 2020-01-01 18:15:34 | 20.00 | 32 | |
| 2 | 1 | 2020-01-01 19:10:54 | 20.00 | 27 | |
| 3 | 1 | 2020-01-03 00:12:37 | 13.40 | 20 | null |
| 4 | 2 | 2020-01-04 13:53:03 | 23.40 | 40 | null |
| 5 | 3 | 2020-01-08 21:10:57 | 10.00 | 15 | null |
| 6 | 3 | null | null | null | Restaurant Cancellation |
| 7 | 2 | 2020-01-08 21:30:45 | 25.00 | 25mins | null |
| 8 | 2 | 2020-01-10 00:15:02 | 23.40 | 15 | null |
| 9 | 2 | null | null | null | Customer Cancellation |
| 10 | 1 | 2020-01-11 18:50:20 | 10.00 | 10 | null |
| customer_id | num_with_changes | num_with_no_changes |
|---|---|---|
| 101 | 0 | 2 |
| 102 | 0 | 3 |
| 103 | 3 | 0 |
| 104 | 2 | 1 |
| 105 | 1 | 0 |
Warning: Null value is eliminated by an aggregate or other SET operation.