修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

v5.0
搜索
    v5.0

      ORDER BY

      概述

      ORDER BY语句可根据规则列表对当前工作表排序。

      <order by statement> ::= 
        "ORDER BY" <sort specification> [ { "," <sort specification> }... ]
      
      <sort specification> ::=
        <value expression> [ <ordering specification> ] [ <null ordering> ]
      
      <ordering specification> ::= "ASC" | "DESC"
      
      <null ordering> ::= "NULLS FIRST" | "NULLS LAST"
      

      详情

      • 未提供排序规则时,默认使用ASC(升序)。若想反转顺序,可以显式使用关键词DESC(降序)。
      • 排序结果时,可使用NULLS FIRSTNULLS LAST控制null出现在非空值之前还是之后。若未明确空值排序时:
        • 当使用ASC排序规则时,默认使用NULLS LAST
        • 当使用DESC排序规则时,默认使用NULLS FIRST

      示例图集

      以下示例根据该图集运行:

      在空图集中运行以下语句创建示例图集:

      INSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6, author:'Alex', publisher:'PulsePress'}),
             (p2:Paper {_id:'P2', title:'Optimizing Queries', score:9, author:'Alex'}),
             (p3:Paper {_id:'P3', title:'Path Patterns', score:7, author:'Zack', publisher:'BrightLeaf'}),
             (p1)-[:Cites {weight:2}]->(p2),
             (p2)-[:Cites {weight:1}]->(p3)
      

      根据属性排序

      可根据特定属性值对表排序。

      MATCH (n:Paper)
      ORDER BY n.score
      RETURN n.title, n.score
      

      结果:

      n.title n.score
      Efficient Graph Search 6
      Path Patterns 7
      Optimizing Queries 9

      根据元素变量排序

      指定元素变量时,根据点或边的_uuid对表排序。

      MATCH (n:Paper)
      RETURN n.title, element_id(n) ORDER BY n
      

      结果:

      n.title element_id(n)
      Optimizing Queries 8718971077612535810
      Efficient Graph Search 8791028671650463745
      Path Patterns 12033620403357220867

      根据表达式排序

      可根据表达式结果对表排序。

      MATCH p = (:Paper)->{1,2}(:Paper)
      RETURN p, path_length(p) AS length ORDER BY length DESC
      

      结果:

      p
      length
      (:Paper {_id: "P1", score: 6, title: "Efficient Graph Search", author: "Alex", publisher: "PulsePress"})-[:Cites {weight: 2}]->(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex", publisher: null})-[:Cites {weight: 1]->(:Paper {_id: "P3", score: 7, title: "Path Patterns", author: "Zack", publisher: "BrightLeaf"}) 2
      (:Paper {_id: "P1", score: 6, title: "Efficient Graph Search", author: "Alex", publisher: "PulsePress"})-[:Cites {weight: 2]->(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex", publisher: null}) 1
      (:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex", publisher: null})-[:Cites {weight: 1]->(:Paper {_id: "P3", score: 7, title: "Path Patterns", author: "Zack", publisher: "BrightLeaf"}) 1

      多级排序

      存在多个排序规则时,表首先根据第一个排序规则排序;对于相等的值,根据下一个排序规则排序,以此类推。

      MATCH (n:Paper)
      RETURN n.title, n.author, n.score 
      ORDER BY n.author DESC, n.score
      

      结果:

      n.title n.author n.score
      Path Patterns Zack 7
      Efficient Graph Search Alex 6
      Optimizing Queries Alex 9

      排序后删除和保留记录

      可以将SKIPLIMIT语句与ORDER BY语句结合使用,从表的开头跳过指定数量的记录,并限制保留的记录数。

      本条查询返回得分第二和第三高的两篇论文的题目:

      MATCH (n:Paper)
      RETURN n.title, n.score
      ORDER BY n.score DESC SKIP 1 LIMIT 2
      

      结果:

      n.title n.score
      Path Patterns 7
      Efficient Graph Search 6

      空值排序

      排序结果时,可使用NULLS FIRSTNULLS LAST控制null出现在非空值之前还是之后。

      本条查询返回得分第二和第三高的两篇论文的题目:

      MATCH (n:Paper)
      RETURN n.title, n.publisher
      ORDER BY n.publisher NULLS FIRST
      

      结果:

      n.title n.score
      Optimizing Queries null
      Path Patterns BrightLeaf
      Efficient Graph Search PulsePress
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写