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

Display each item and its total sales in the ninth (top) decile according to the total sales.

   SELECT itemID, sumPrice
   FROM (SELECT a1.itemID, SUM(price)
   FROM Sales a1
   GROUP BY a1.itemID) AS T1(itemID, sumPrice)
   QUALIFY QUANTILE(10,sumPrice)=9;