SQL recipes

Run and edit queries with their sample data included.

01

Lists & arrays

A little function. A whole new list.

Apply the same idea to every value. A lambda lets you describe the transformation right where you use it.

A little function. A whole new list.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

02

Text & patterns

Turn a label into a useful key.

Trim the edges, normalize case, and replace runs of spaces. Small functions compose into a readable cleaning step.

Turn a label into a useful key.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

03

Dates & time

Give your timestamps a rhythm.

Group events into calendar months with date_trunc. The same pattern works for days, weeks, and years.

Give your timestamps a rhythm.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

04

JSON

Find the value inside the document.

Extract a JSON field directly as text, ready to use in the rest of your query.

Find the value inside the document.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

05

Aggregates

Find the middle of the story.

Compare the average with the median to see how an unusually large value changes your summary.

Find the middle of the story.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

06

Files & tables

Make a small dataset from nothing.

A table function produces rows you can query. range starts at zero and stops before the upper bound.

Make a small dataset from nothing.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.

Functionsrange()↗