Fork me on GitHub
#sql
<
2017-10-20
>
val_waeselynck07:10:46

[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?

val_waeselynck07:10:13

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!

val_waeselynck07:10:28

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.

val_waeselynck07:10:22

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

val_waeselynck07:10:39

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

bja14:10:47

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