1.1 - 8.10 - nPath Example: Sessions Start at Home and Visit Page1 - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

This example finds the sessions that start at the home page and visit Page1.

SQL Call

SELECT * FROM NPath@coprocessor (
  ON aggregate_clicks PARTITION BY sessionid ORDER BY clicktime
  USING
    Mode(nonoverlapping)
    Pattern('^H.A*.P1.A*')
    Symbols(pagetype='home' AS H, pagetype='page1' AS P1, TRUE AS A)
    Result(FIRST(sessionid OF A) AS sessionid,
           accumulate(pagetype OF ANY(H,P1,A)) AS path)
) AS dt;

Output

 sessionid path                                                                                                                                       
 --------- ------------------------------------------------------------------------------------------------------------------------------------------ 
         4 [home, home, home, home, home, home, home1, home1, home1, page1, page1, page1]                                                            
         2 [home, home, home, home, home, home, home, home, home, home1, page1, checkout, checkout, home, home]                                      
         5 [home, home, home, home, home1, home1, home1, page1, page1, page1, page2, page2, page2, checkout, checkout, checkout, page2, page2, page2]
         1 [home, home1, page1, home, home1, page1, home, home, home, home1, page1, checkout, home, home, home, home, home, home, home, home, home]  
         3 [home, home, home, home, home, home, home, home, home1, page1, home, home1, page1, home]

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.