Write the function to simulate `ALTER` query between first and last state
Write the function to simulate
ALTERquery between first and last state