17.10 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1211-171K
Language
English (United States)

In the following example, the P_INTERSECT operator is used in the selection list.

SELECT period2 P_INTERSECT period1 
FROM product_tests 
WHERE pid = 11804;

Assume the query is executed on the following table product_tests where period1 is a PERIOD(TIME(1)) column and period2 is a PERIOD(TIME(0)) column:

pid     period1                        period2
-----   ----------------------------   ------------------------
11804   ('10:10:10.1', '11:10:10.1')   ('10:10:10', '10:10:11')
10996   ('11:10:10.1', '11:40:40.1')   ('10:10:10', '10:10:11')

The result is as follows:

(period2 P_INTERSECT period1)
-----------------------------
('10:10:10.1', '10:10:11.0')