Implement generating queries for showing tasks.