Order by Clause

Description

The ORDER BY clause specifies an ordering of the rows of the result table.

Click here to navigate to the IBM DB2 docs page for this syntax.

Grammar Syntax

Sample Source Patterns

The only paths of Order By in Db2 that are not supported in Snowflake are those when it is used with ORDER OF and INPUT SEQUENCE, hence if these are present, the whole order by clause is commented.

IBM DB2 Supported Examples

Select * from TABLE1 ORDER BY CustomerID; 

Snowflake

Select * from TABLE1 ORDER BY CustomerID;

IBM DB2 Not Supported Examples

Select* from ORDERBYTest ORDER BY ORDER OF TableDesignator;
Select* from ORDERBYTest ORDER BY INPUT SEQUENCE;

Snowflake

Select* from ORDERBYTest
-- ** MSC-ERROR - MSCEWI1021 - ORDER BY ORDER OF NOT SUPPORTED **
--                         ORDER BY ORDER OF TableDesignator
                                                          ;
Select* from ORDERBYTest
-- ** MSC-ERROR - MSCEWI1021 - ORDER BY INPUT SEQUENCE NOT SUPPORTED **
--                         ORDER BY INPUT SEQUENCE
                                                ;
  1. MSCEWI1021: NODE NOT SUPPORTED

Last updated