You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sql.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ SELECT * FROM gaia ORDER BY phot_g_mean_mag LIMIT 10
44
44
SELECT*FROM gaia ORDER BY phot_g_mean_mag LIMIT10
45
45
```
46
46
47
-
This returns an array of 10 rows, inspected here:
47
+
This returns an array of 10 rows as an [Apache Arrow](./lib/arrow) table, inspected here:
48
48
49
49
```js echo
50
50
top10
@@ -144,11 +144,11 @@ Plot.plot({
144
144
SQL fenced code blocks are shorthand for the `sql` tagged template literal. You can invoke the `sql` tagged template literal directly like so:
145
145
146
146
```js echo
147
-
constrows=awaitsql`SELECT random() AS random`;
147
+
const[row]=awaitsql`SELECT random() AS random`;
148
148
```
149
149
150
150
```js echo
151
-
rows[0].random
151
+
row.random
152
152
```
153
153
154
154
The `sql` tag is useful for querying data within JavaScript, such as to query data for visualization without needing to create a separate SQL code block and giving the data a name. For example, below we use DuckDB to bin stars by brightness, and then visualize the bins as a histogram using a [rect mark](https://observablehq.com/plot/marks/rect).
0 commit comments