Please review final exam question 5

There is only 1 answer that can return the requested results and it is flagged as incorrect.

@Anthony_33107

There are, in fact, two possible answers that will generate the correct data in the desired format (in addition to the one shown in the question). However, only one of those is optimized. That’s the correct answer.

Actually, only one answer, while not optimal, will generate the correct data. The “correct” answer is likely to improve execution, but it does not produce the expected results. The question asks which option will produce the expected results (implying that the results should match the results as shown in the question) AND likely to improve execution. I dismissed the “correct” answer because it does not produce the expected results as defined in the question.

I understand that the question focuses on optimization, however the requirement calls for correct data and improved execution. I would not consider it correct to deliver a more optimally written query that does not meet the data requirement.

I do not know what you mean by

But I do not see any document in the question that indicates the structure of the output. What I read from the requirement (as they were when I took the course) is

We would like to find the cities in the USA where the minimum number of sunny days is 200 and the average number of sunny days is at least 220. Lastly, we’d like to have the results sorted by the city’s name. The matching documents may or may not have a different shape than the initial one.

The key part is embolden by me.

I agree with your point regarding the results’ shape. At the same time, I find it confusing if two answers solve the problem and one has a matching shape while the other does not. When the requirement states that the matching documents may or may not have a different shape than the initial one, it leaves the meaning up to the reader’s interpretation. That introduces ambiguity as to the “correct” answer.

I understand why the correct answer does meet both requirements and demonstrates a more optimally written pipeline. I also stand corrected in that I interpreted the question too narrowly, considering the question’s intent. I do, however, maintain that the ambiguity in the requirements, combined with the sample pipeline in the question can cause one to reasonably infer that the expectation is to produce the same results as the sample pipeline, just with improved execution.

Would you please look closer to the syntax of the correct answer, I think there is a typo or syntax error, which is make it not the correct answer.

Thanks

Can you be more explicit about the syntax error? What it is and what is should be.

I can not because that would direct to the answer, sorry!!

@Salim_91084

There are no typos or syntax errors in the correct answer. I have successfully validated this running the results against a sample database.

If you believe that you have found an error, please use the “Report an issue” tab to send that to the curriculum team. As that does not show here, you can post code in that message.