SQL Helper functions

Functions for manipulating SQL and arrays