video 31- Implementing the query function