Example - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

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')