AI-200 Data Management Services And Vector Search Practice Question
You are writing a query in Azure Cosmos DB for NoSQL that sorts results by vector similarity and also filters results by a category property. How must you order the clauses in your SQL statement?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The WHERE clause must come before the ORDER BY VectorDistance() clause
In Azure Cosmos DB, when using VectorDistance in an ORDER BY clause along with a WHERE filter, the WHERE clause must precede the ORDER BY clause.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The WHERE clause must come before the ORDER BY VectorDistance() clause
Why this is correct
Cosmos DB SQL syntax requires filtering via WHERE before sorting via ORDER BY.
- ✗
VectorDistance must be placed in the SELECT clause instead of ORDER BY
Why it's wrong here
VectorDistance must be in the ORDER BY clause to perform vector k-NN ranking.
- ✗
WHERE and ORDER BY clauses cannot be used in the same query when using vectors
Why it's wrong here
Combining WHERE and ORDER BY VectorDistance is fully supported.
- ✗
The ORDER BY clause must come before the WHERE clause
Why it's wrong here
Putting ORDER BY before WHERE results in a syntax error in SQL.
About these practice questions
One of 503 original AI-200 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official Microsoft exam blueprint
This AI-200 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-200 exam.