For more than half a century, relational data management has lived in a ''two-language world'': a powerful declarative sublanguage for data (SQL) glued to a host programming language for everything else. This split into two worlds creates friction: First, there is an ''impedance mismatch'' between the set oriented query language SQL and the usually more imperative host programming language. And second, while programming languages aim for producing reusable components, SQL queries are often ad-hoc, and there is little if any reuse of logic and functionality across queries.
Leis et al. (Thu,) studied this question.