7.44

Given two relations \(r(A, B, \text{validtime})\) and \(s(B, C, \text{validtime})\) where \(\text{validtime}\) denotes the valid time interval, write an SQL query to compute the temporal natural join of the two relations. You can use the && operator to check if two intervals overlap and the * operator to compute the intersection of two intervals.


SELECT A, r.B, r.validtime * s.validtime
FROM r INNER JOIN s 
    ON (r.B = s.B 
        AND
        r.validtime && s.validtime)