top 运算符top operator
返回按指定列排序的前 N 列。Returns the first N records sorted by the specified columns.
T | top 5 by Name desc nulls last
语法Syntax
T | top
NumberOfRows by
Expression [asc
| desc
] [nulls first
| nulls last
]T | top
NumberOfRows by
Expression [asc
| desc
] [nulls first
| nulls last
]
参数Arguments
- NumberOfRows:要返回的 T 的行数。NumberOfRows : The number of rows of T to return. 可以指定任何数值表达式。You can specify any numeric expression.
- 表达式 :要作为排序依据的标量表达式。Expression : A scalar expression by which to sort. 值的类型必须是数字、日期、时间或字符串。The type of the values must be numeric, date, time or string.
asc
或desc
(默认)可能会控制实际从范围“底部”还是“顶部”进行选择。asc
ordesc
(the default) may appear to control whether selection is actually from the "bottom" or "top" of the range.nulls first
(asc
顺序的默认值)或nulls last
(desc
顺序的默认值)可以用来控制 null 值是在范围的开头还是结尾。nulls first
(the default forasc
order) ornulls last
(the default fordesc
order) may appear to control whether null values will be at the beginning or the end of the range.
提示
top 5 by name
等效于语义和性能透视中的 sort by name | take 5
表达式。top 5 by name
is equivalent to the expression sort by name | take 5
both from semantic and performance perspectives.
请参阅See also
- 使用 top-nested 运算符可生成分层的(嵌套的)排名靠前的结果。Use top-nested operator to produce hierarchical (nested) top results.