Harmonizing the declarative and imperative in database systems