product_id
values where the minimum change_date
is greater than 2019-08-16
and assign a price of 10
to them.product_id
, find the maximum change_date
that is less than or equal to 2019-08-16
.Products
table to get the new_price
for the last change date.UNION ALL
to combine the results of step 1 and step 3 into a single result set.erDiagram Products { int product_id int new_price date change_date }