A database programmer's treasury of useful and ugly SQL query scripts