zlacker

[parent] [thread] 2 comments
1. chubot+(OP)[view] [source] 2024-08-29 00:09:39
The next thing I would like is to define a function / macro that has a bunch of |> terms.

I pointed out that you can do this with shell:

Pipelines Support Vectorized, Point-Free, and Imperative Style https://www.oilshell.org/blog/2017/01/15.html

e.g.

    hist() {
      sort | uniq -c | sort -n -r
    }

    $ { echo a; echo bb; echo a; } | hist
      1 bb
      2 a

    $ foo | hist
    ...
   
Something like that should be possible in SQL!
replies(1): >>jshute+Sp4
2. jshute+Sp4[view] [source] 2024-08-30 17:23:53
>>chubot+(OP)
It is, using table-valued functions (TVFs).

There's an example at the bottom of this file:

https://github.com/google/zetasql/blob/master/zetasql/exampl...

replies(1): >>chubot+DQ6
◧◩
3. chubot+DQ6[view] [source] [discussion] 2024-08-31 21:23:18
>>jshute+Sp4
That's cool, thanks!

What about scalar valued functions? :) So I can reuse an expression in a WHERE and so forth

(and I appreciate that HAVING can be generalized/removed)

[go to top]