added query for inserting random history