Does KQL Order By Return Ascending No_Bikes Results?

Answer Correct answer: B — the code's order by clause omits asc, so KQL sorts No_Bikes descending and does not meet the ascending-order requirement.

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You have a Fabric eventstream that loads data into a table named Bike_Location in a KQL database. The table contains the following columns: BikepointID Street Neighbourhood No_Bikes No_Empty_Docks Timestamp You need to apply transformation and filter logic to prepare the data for consumption. The solution must return data for a neighbourhood named Sands End when No_Bikes is at least 15. The results must be ordered by No_Bikes in ascending order. Solution: You use the following code segment: exhibit Does this meet the goal?

  1. Yes
  2. No Correct Answer

Community Insight

The question tests whether you know KQL's order by operator defaults to descending, so any code that omits the asc keyword cannot satisfy an ascending-order requirement.

In Microsoft Fabric and Azure Data Explorer KQL, the order by (sort) operator defaults to descending order, unlike SQL's ascending default. For the Bike_Location query that must return Sands End rows with No_Bikes at least 15 sorted low-to-high, the sample code fails because it omits the explicit asc keyword, so the correct verdict is B (No).

Answer A (Yes) is the common wrong choice: learners transfer SQL semantics into KQL, assuming order by is ascending by default and that the filter and neighbourhood conditions alone satisfy the goal.

Community Discussion (16 comments)

alinavit 👍 1 Selected: B
Table name is case sensitive, thus bike_location (instead of Bike_location) will not work. The rest is correct
Rozamunde 👍 4 Selected: B
Duplicate of previous question
smanzana 👍 3 Selected: B
B is correct
smanzana 👍 3 Selected: B
B-No, in KQL by default “order by” is desc order
akmorsh 👍 4 Selected: B
Correct Answer: B. No 🔍 Explanation: The code is almost identical to the previous correct example, but this time it uses order by instead of sort by, and that’s the issue.
benni_ale 👍 11 Selected: B
no, order by by default is desc in kql
568f95c 👍 2 Selected: A
They are asking for the order of No_Bikes in ascending order in this question
Tuki93 👍 5 Selected: B
default is desc in Kusto
mauriciorosa8 👍 5 Selected: B
The default sorting order in KQL is descending (desc); ascending (asc) must be explicitly specified when needed.
8d6881f 👍 4 Selected: B
no. In kql desc is default for sort/order by: "asc sorts into ascending order, low to high. Default is desc, high to low." https://learn.microsoft.com/en-us/kusto/query/sort-operator?view=microsoft-fabric
amli123 👍 2 Selected: B
default is desc
MuffiSan 👍 2 Selected: B
no. In kql desc is default for sort by: "asc sorts into ascending order, low to high. Default is desc, high to low." https://learn.microsoft.com/en-us/kusto/query/sort-operator?view=microsoft-fabric
MuffiSan 👍 1
"The sort and order operators are equivalent"
QAZdbarhate12345678 👍 2 Selected: A
The provided solution meets the goal. Analysis: Filtering Condition: The code includes filter Neighbourhood == "Sands End" and No_Bikes >= 15, which satisfies the requirement to only include rows where the neighborhood is "Sands End" and No_Bikes is at least 15. Ordering: The order by No_Bikes clause ensures that the results are sorted by No_Bikes in ascending order, meeting the stated requirement. Projection: The project BikepointID, Street, Neighbourhood, No_Bikes, No_Empty_Docks, Timestamp ensures that the necessary columns are returned. Conclusion: The solution fulfills all the requirements. Correct Answer: A. Yes.
Bharat 👍 2 Selected: A
the answer is yes since you don't have to specify the "asc" option. It is the default.
GHill1982 👍 8
The answer is no. The default for order by in KQL in desc therefore asc must be specified. Confusing at first as it is the opposite of SQL. https://learn.microsoft.com/en-gb/kusto/query/sort-operator?view=azure-data-explorer#parameters

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The stated requirement is explicit: results must be ordered by No_Bikes in ascending order. In KQL, order by (and its synonym sort by) defaults to desc, so the code segment sorts No_Bikes from high to low instead of low to high. Because the ordering clause in the exhibit contains no asc keyword, the solution does not meet one of the three mandatory conditions — filter on Sands End, No_Bikes >= 15, and ascending order. Therefore the correct verdict is B, No, since "Does this meet the goal?" requires every stated condition to hold.

Why the Other Options Are Wrong

Option A (Yes) would only be valid if KQL's default sort direction were ascending, which it is not; Microsoft's sort operator documentation states that asc sorts low to high and that the default is desc, high to low. This trap is deliberately inverted relative to T-SQL, where ORDER BY defaults to ascending, which is why learners from a SQL background误 select A. Even though the neighbourhood filter and the No_Bikes threshold may be correctly expressed in the code, a single unmet requirement — ascending ordering — makes the whole solution fail. The near-identical wording of the previous question in this series, where a correct variant presumably used an explicit asc or a different construct, further reinforces that the ordering keyword is the deciding factor.

Community Comment Notes

Multiple commenters converged on the same reasoning: benni_ale wrote "no, order by by default is desc in kql", and mauriciorosa8 confirmed that "The default sorting order in KQL is descending (desc); ascending (asc) must be explicitly specified when needed." GHill1982 pointed to Microsoft's sort-operator documentation and noted the behaviour is "the opposite of SQL," while 8d6881f quoted the parameter text "Default is desc, high to low." akmorsh highlighted that the code uses order by rather than sort by and still omits asc, and smanzana repeated "B-No, in KQL by default 'order by' is desc order." Only one dissenter, 568f95c, argued the question asks for ascending order without addressing the default, and Rozamunde noted the item is a duplicate of an earlier question in the series.

Official Reference

Exam Strategy

When a KQL snippet is graded against an ordering requirement, scan the sort clause first for an explicit asc or desc keyword — absence of asc means descending. Remember the KQL/SQL inversion: in SQL omission means ascending, in KQL omission means descending.

Frequently Asked Questions

Why does order by without asc fail the ascending requirement in KQL?

In KQL, order by and sort by default to descending order, so omitting asc sorts No_Bikes from highest to lowest. Ascending must be requested explicitly with the asc keyword.

Is order by different from sort by in a Fabric KQL query?

No — order by and sort by are synonyms and behave identically, both defaulting to descending. Neither fixes the missing asc keyword in the exhibit code.

More DP-700 FAQ →

Related Analysis

← Back to DP-700 Study Guide