16.20 - Example - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

To order salespersons based on sales within a sales region, the following SQL query might yield the following results.

   SELECT ROW_NUMBER() OVER (PARTITION BY sales_region 
                             ORDER BY sales_amount DESC),
   sales_person, sales_region, sales_amount
   FROM sales_table;
   
   Row_Number()  sales_person  sales_region  sales_amount
   ------------  ------------  ------------  ------------
              1  Baker         East                   100
              2  Edwards       East                    99
              3  Davis         East                    89
              4  Adams         East                    75
              1  Garabaldi     West                   100
              2  Connors       West                    99
              3  Fine          West                    99