Sha256: 91b8084354dc43291fefa50b0b582ca27e566208453d79d3941edd0d707e74a3

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

- alf: |-
    sort(suppliers, [[:sid, :asc]])
  sql: |-
    SELECT t1.sid, t1.name, t1.status, t1.city
      FROM suppliers AS t1
    ORDER BY t1.sid ASC
#
- alf: |-
    sort(suppliers, [[:sid, :desc]])
  sql: |-
    SELECT t1.sid, t1.name, t1.status, t1.city
      FROM suppliers AS t1
    ORDER BY t1.sid DESC
#
- alf: |-
    sort(suppliers, [[:city, :desc], [:sid, :asc]])
  sql: |-
    SELECT t1.sid, t1.name, t1.status, t1.city
      FROM suppliers AS t1
    ORDER BY t1.city DESC, t1.sid ASC
#
- alf: |-
    sort(sort(suppliers, [[:sid, :asc], [:city, :desc]]), [:sid, :asc])
  sql: |-
    SELECT t1.sid, t1.name, t1.status, t1.city
      FROM suppliers AS t1
    ORDER BY t1.sid ASC, t1.city DESC
#
- alf: |-
    sort(sort(suppliers, [:sid, :asc]), [:sid, :desc])
  sql: |-
    WITH t2 AS (
      SELECT t1.sid,
             t1.name,
             t1.status,
             t1.city
        FROM suppliers AS t1
       ORDER BY t1.sid ASC
    )
    SELECT t2.sid, t2.name, t2.status, t2.city
      FROM t2 AS t2
    ORDER BY t2.sid DESC
#
- alf: |-
    sort(union(suppliers_in_paris, suppliers_in_london), [[:sid, :asc]])
  sql: |-
    WITH t3 AS (
      (SELECT t1.sid, t1.name, t1.status, t1.city
        FROM suppliers AS t1
       WHERE t1.city = 'Paris')
       UNION
     (SELECT t2.sid, t2.name, t2.status, t2.city
       FROM suppliers AS t2
      WHERE t2.city = 'London')
    )
    SELECT t3.sid, t3.name, t3.status, t3.city
      FROM t3 AS t3
    ORDER BY t3.sid ASC

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.16.3 spec/sql/queries/03-sort.yml
alf-0.16.2 spec/sql/queries/03-sort.yml
alf-0.16.1 spec/sql/queries/03-sort.yml
alf-0.16.0 spec/sql/queries/03-sort.yml
alf-0.15.0 spec/sql/queries/03-sort.yml