Query generation. Part II