Basic query implementation.