adding new sql code: start of machinio analytics