Comparing TIMESTAMPS in Teradata

The following example compares two TIMESTAMP numbers to find out if they are within 30 minutes of each other.

First define a table:
CREATE TABLE PhoneTime
(phone_no CHARACTER(10)
,start_time TIMESTAMP(0)
,end_time TIMESTAMP(0));

Note that the difference between two TIMESTAMP types is an Interval type:
SELECT phone_no
FROM PhoneTime
WHERE (end_time - start_time) DAY(4) TO MINUTE > INTERVAL ’30’ MINUTE;