Fork me on GitHub

[Not Clojure - specific] do you know guys of anything like 'parameterized views' in SQL (in the sense of views that accept other relations as parameters), either in the industry or in research?


I've really come to think of the query part of SQL as an expression-based language (similar to lambda calculus), in which the values are relations, and the basic operations are joining, filtering, projecting etc. So I find SQL to be like a lambda-calculus language that doesn't have functions, expect maybe for views which are like 0-arity functions. That's too bad!


For example: on a recent project I did with a significant part SQL, I've really missed such a feature, especially for aggregations - e.g I'd like to be able to define a view which computes the age distribution of a set of persons, which would precisely be parameterized by any relations of person, allowing to compose the aggregating logic with any filtering logic.


Does this resonate with anyone here? I'd love to find projects or articles on this topic, but don't know where to look.


I'll be also asking in #off-topic 🙂


a SQL toolkit for clojure, HoneySQL lets you compose data structures (maps) representing relations together.