Helper stuff for SQL