- Teradata Cookbook
- Abhinav Khandelwal Rajsekhar Bhamidipati
- 78字
- 2025-04-04 17:23:32
How to do it...
- Connect to Teradata Database using SQLA or Studio.
- Execute the following query to get the result set:
/*OLAP select*/
SELECT EMP_ID, SAL_Months, sale_done, sale_target, min(sale_done) OVER ( PARTITION BY EMP_ID ORDER BY
SAL_Months ROWS 2 PRECEDING) FROM EMP_SAL;
- The result set will have the minimum amount of sales from employees in 3 months.
- The RANK and ORDER BY functions will be used to sort rows in ascending and descending order as shown in code.