Two questions from Reddit’s /r/mysql related to Window Functions: How do I make row.numbers happen and Get the difference between two values in different recordings.
One of the new things in MySQL is the implementation of Window Functions. They are related to aggregates, but do not actually lump values together.
To better understand what goes on, let’s create some fake data to work with:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import MySQLdb.cursors as cursors
from datetime import datetime, timedelta
from random import randint, random
# We have {sensors} sensors, each producing {values} values
# between {minvalue} and {maxvalue}, at a random time after {starttime} …
[Read more]