Rosbank's DDS layer stores contract history using SCD2. Each record version is valid over a right-open interval stored in the valid column, meaning the lower bound is inclusive and the upper bound is exclusive. An analyst needs a snapshot of contract states as of 2024-03-15. For each contract, return the version whose valid interval contains that date, with these columns: contract_id, status, rate_pct, dt_from (the lower bound of valid), and dt_to. Exclude contracts with no active version on that date. For dt_to, return the upper bound of the valid interval. If the interval has no upper bound, return NULL.
contract_idstatusrate_pctdt_fromdt_toShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in