title: Populating scd type 2 kind of dates for active inactive input data
body: <p><a href="https://i.stack.imgur.com/pCmY7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pCmY7.png" alt="input and output" /></a></p>
  <p>I saw this question in one of the interviewing practice platforms and initially assumed its a gaps and islands problem, but I couldn't go ahead with that logic.
  In ETL tool called Abinitio, there is a function called key_change using which we can solve these kind of problems. But, I am unable to do it in sql.
  Could you please help me with this</p>