17.排序 ORDER BY

下边的例子我们要求人民被年龄按升序列出。默认升序

  • ASC 升序

  • DESC 降序

Query:

SELECT fname, age 
    FROM tutorial 
        ORDER BY age

结果:

{
  "results": [
    {
      "age": 18,
      "fname": "Fred"
    },
    {
      "age": 20,
      "fname": "Harry"
    },
    {
      "age": 40,
      "fname": "Jane"
    },
    {
      "age": 46,
      "fname": "Dave"
    },
    {
      "age": 46,
      "fname": "Earl"
    },
    {
      "age": 56,
      "fname": "Ian"
    }
  ]
}

Last updated

Was this helpful?