Added more SQL functions for easy query construction