# Training video: SQL / query builder

**Target length:** 10 minutes  
**Kernel on camera:** 2.74.26  
**Audience:** Operator who used the SQL box as a catalog and now needs live SELECT/JOIN.

Control Center **SQL / builder** posts to `POST /api/v1/sql`. That is the same `handleLine` as TCP 2143. It is not `/api/v1/cord` analog. `JOIN_BUILD … RUN` emits SELECT and runs testdb relate. Bare `SELECT *` on a join is not PostgreSQL star expansion — the builder fills columns from `schema.<table>` (id fallback). Not Power BI. Not psql. certifiedClaim stays false.

## On-screen beats

1. Create two small tables and two rows on 2143.
2. Open `/console` → SQL / builder. Load tables. Pick FROM orders, INNER JOIN customers, ON orders.customer = customers.id. Emit SQL. Run builder.
3. Grid shows Ada. Raw JSON under the grid.
4. Terminal: `veloce sql "SELECT orders.id, customers.name FROM orders JOIN customers ON orders.customer = customers.id"`
5. `veloce join-build LEFT=orders RIGHT=customers ON LEFT.customer=RIGHT.id TYPE INNER` then `--run`.

## Spoken script

“The SQL box used to post SHOW CLI to analog packs. As of 2.74.3 it talks to the live engine. I will emit a join, run it, and then run the same text from the client CLI.”

```text
CREATE TABLE orders (id TEXT PRIMARY KEY, customer TEXT)
CREATE TABLE customers (id TEXT PRIMARY KEY, name TEXT)
INSERT ROW orders 1 {"id":"1","customer":"ada"}
INSERT ROW customers ada {"id":"ada","name":"Ada"}
JOIN_BUILD LEFT=orders RIGHT=customers ON LEFT.customer=RIGHT.id TYPE INNER
JOIN_BUILD LEFT=orders RIGHT=customers ON LEFT.customer=RIGHT.id TYPE INNER RUN
```

```bash
veloce sql --host 127.0.0.1 --sql-port 2143 --query "SHOW TABLES"
veloce join-build LEFT=orders RIGHT=customers ON LEFT.customer=RIGHT.id TYPE INNER --run
```

```http
POST /api/v1/sql
{"sql":"SELECT orders.id, customers.name FROM orders JOIN customers ON orders.customer = customers.id"}
GET /api/v1/sql/tables
POST /api/v1/sql/build
{"from":"orders","joins":[{"type":"INNER","table":"customers","onLeft":"orders.customer","onRight":"customers.id"}],"run":true}
```

## Do not say

- That this is psql or pgAdmin.
- That SELECT * on a JOIN expands like PostgreSQL.
- That JOIN_BUILD RUN still uses the analog ORDERS demo tables. It uses live testdb relate.
