-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL.fold
More file actions
36 lines (29 loc) · 743 Bytes
/
SQL.fold
File metadata and controls
36 lines (29 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- http://www.try-alf.org/blog/2014-12-03-what-would-a-functional-sql-look-like
-- http://lambda-the-ultimate.org/node/2440
with candidate_rows as (
select id
from table
where conditions
limit 1000
for update nowait
), update_rows as (
update table
set column = value
from candidate_rows
where candidate_rows.id = table.id
returning table.id
)
select count(1) from update_rows;
|> ~ . -> => >-
suppliers
| join shipments
| where #city == "London"
| select #sid, #pid, #name, #qty
suppliers
> join shipments
> where #city == "London"
> select #sid, #pid, #name, #qty
suppliers
, join shipments
, where @city = "London"
, select @sid, @pid, @name, @qty