Hacker News new | ask | show | jobs
by simonw 1761 days ago
Have you used CTEs much (aka the WITH statement)?

I find them to be a huge step forwards in terms of adding composability to complex queries.

2 comments

Yes I concur: CTEs is closer to the spirit of relational algebra: every step/expression should yield a table/relation.

As data munging is about combining/correlating/sorting/grouping data, why not have a sound (bag) algebra to do that? Such algebra would give us equational reasoning, proofs, etc.

And consequently: students would be learning an algebra which is easier to learn IMO.

Thanks yes I have learned to use the WITH statement, and I agree it gives more composability. But still, a half way house wouldn't you say?