Hacker News new | past | comments | ask | show | jobs | submit login

For any who want this kind of pipelining way-of-writing-SQL that has the benefit of existing in live production databases today, I highly, highly recommend looking into Postgres' and Snowflake's LATERAL JOIN keyword.

https://heap.io/blog/postgresqls-powerful-new-join-type-late...

https://stackoverflow.com/questions/28550679/what-is-the-dif...

https://docs.snowflake.com/en/sql-reference/constructs/join-...

The TL;DR is that they allow you to reuse annotated and aggregated columns in an incredibly elegant way. Compared to OP's proposal, you still do need to start the query with what columns you want to come out at the end, and normal SQL weirdnesses still apply - but it's far, far, easier when writing massive analytics queries to see the flow of variables from one stage to another.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: