“ORDER BY … USING” clause in PostgreSQL

后端 未结 4 412
别那么骄傲
别那么骄傲 2020-12-13 18:10

The ORDER BY clause is decribed in the PostgreSQLdocumentation as:

ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...]
         


        
4条回答
  •  轮回少年
    2020-12-13 18:11

    Optionally one can add the key word ASC (ascending) or DESC (descending) after any expression in the ORDER BY clause. If not specified, ASC is assumed by default. Alternatively, a specific ordering operator name can be specified in the USING clause. An ordering operator must be a less-than or greater-than member of some B-tree operator family. ASC is usually equivalent to USING < and DESC is usually equivalent to USING >.

    PostgreSQL 9.0

    It may look something like this I think (I don't have postgres to verify this right now, but will verify later)

    SELECT Name FROM Person
    ORDER BY NameId USING >
    

提交回复
热议问题