IBM Support

NTILE function explained

Question & Answer


Question

How to do NTILE function in PureData System for Analytics?

Answer

NTILE is a shortcut derivation for row_number/count division.

Specifically:

      select      some_column,
                       NTILE(M) over (order by some_column asc)
         from      some_table
    can be rewritten as:

        select      some_column,
                      (row_number( ) over (order by some_column asc) * M - 1)/(count(*) over ()) + 1 as tile
        from       some_table

Where M is the number of buckets you want the sample to be divided into.
[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ566002

Document Information

More support for:
IBM PureData System

Software version:
1.0.0

Document number:
463687

Modified date:
17 October 2019

UID

swg21571467