add sql queries and call # ranges