order 运算符order operator

按照一个或多个列的顺序对输入表的行排序。Sort the rows of the input table into order by one or more columns.

T | order by country asc, price desc

备注

order 运算符是 sort 运算符的别名。The order operator is an alias to the sort operator. 有关详细信息,请参阅 sort 运算符For more information, see sort operator

语法Syntax

T | order by column [asc | desc] [nulls first | nulls last] [, ...]T | order by column [asc | desc] [nulls first | nulls last] [, ...]

参数Arguments

  • T :要排序的表输入。T : The table input to sort.
  • column:T 的列,用作排序依据。column : Column of T by which to sort. 值的类型必须是数字、日期、时间或字符串。The type of the values must be numeric, date, time or string.
  • asc 按升序(即由低到高)排列。asc Sort by into ascending order, low to high. 默认值是 desc,降序,由高到低。The default is desc, descending high to low.
  • nulls firstasc 顺序的默认值)将把 null 值放在开头,nulls lastdesc 顺序的默认值)将把 null 值放在末尾。nulls first (the default for asc order) will place the null values at the beginning and nulls last (the default for desc order) will place the null values at the end.