修改密码

请输入密码
请输入密码 请输入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> [ "ASC" | "DESC" ] [ "NULLS FIRST" | "NULLS LAST" ]
      

      详情

      • 默认使用ASC(升序);若想反转顺序,可显式使用关键词DESC(降序)。
      • 使用NULLS FIRSTNULLS LAST可控制null值排在非null值之前还是之后。若明确null值排序时:
        • ASC默认使用NULLS LAST
        • DESC默认使用NULLS FIRST

      示例图

      CREATE GRAPH myGraph { 
        NODE Paper ({title string, score uint32, author string, publisher string}),
        EDGE Cites ()-[{weight uint32}]->()
      } PARTITION BY HASH(Crc32) SHARDS [1]
      

      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
      2
      1
      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

      排序后删除和保留记录

      ORDER BY语句后使用SKIPLIMIT语句,可跳过工作表开头指定数量的记录,或限制保留的记录数。

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

      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

      Null值排序

      返回得分第二和第三高的两篇论文题目,如果有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
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写