Test query functionality.