52860c3267
Three more casts on "doing" pages:
- first-project reuses the quickstart cast (the create→insert→show tour)
- modes (new): a simple command, then `mode advanced` where the same command
also prints "Executing SQL: …" (the teaching echo — "learn the SQL underneath")
- undo-redo (new): insert two rows, `undo` (Y-confirm modal) backs one out,
`redo` restores it
Also fix the cast endings (review feedback): scripts ended by typing a `quit`
command, which — once the trim drops the shell exit — left a dangling "quit" in
frame with no payoff. End every cast with Ctrl-C instead (the app's quit key,
KeyCode::Char('c')+CTRL): it types nothing, so the cast ends cleanly on the
last content frame. Generator gains a `CtrlC` key; all six casts regenerated.
Convert the three pages to .mdx and embed. Build clean (26 pages); 6 casts.
65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
---
|
|
title: Simple and advanced modes
|
|
description: How the playground's two input modes differ, how to switch, and the one-line escape hatch.
|
|
sidebar:
|
|
order: 3
|
|
---
|
|
|
|
import Demo from '../../../components/Demo.astro';
|
|
|
|
The playground has two input modes. You can do everything a beginner needs
|
|
in **simple mode**, and reach for **advanced mode** when you want full SQL.
|
|
|
|
<Demo src="/casts/modes.cast" title="The same command in both modes — advanced mode also shows the SQL it runs for you." />
|
|
|
|
## Simple mode (the default)
|
|
|
|
Simple mode is a friendly, keyword-based command language designed for
|
|
learning. Commands read close to English:
|
|
|
|
```rdbms
|
|
create table authors with pk author_id(serial)
|
|
show data authors
|
|
```
|
|
|
|
Simple mode accepts these learning commands plus the app-level commands
|
|
(like `save`, `undo`, and `help`). If you type raw SQL here, the playground
|
|
gently points you at advanced mode instead of failing silently.
|
|
|
|
## Advanced mode (SQL)
|
|
|
|
Advanced mode accepts standard SQL — `SELECT`, `INSERT`, `CREATE TABLE`, and
|
|
more — alongside the same app-level commands:
|
|
|
|
```sql
|
|
select title, published from books where published >= 2000 order by published;
|
|
```
|
|
|
|
Switch modes with the `mode` command:
|
|
|
|
```rdbms
|
|
mode advanced
|
|
mode simple
|
|
```
|
|
|
|
The mode you leave a project in is remembered and restored the next time you
|
|
open it, so a project set up for SQL practice reopens in advanced mode.
|
|
|
|
## The one-line escape
|
|
|
|
When you are in simple mode and want to run a single SQL statement without
|
|
switching, prefix the line with a colon:
|
|
|
|
```rdbms
|
|
:select count(*) from books
|
|
```
|
|
|
|
That runs just this one line as SQL; you stay in simple mode afterwards.
|
|
|
|
## Seeing the SQL behind a command
|
|
|
|
When you run a simple-mode command in advanced mode, the playground prints
|
|
the equivalent SQL beneath your command. It is a built-in way to learn how
|
|
the friendly commands map onto real SQL — the same statements you could type
|
|
yourself in advanced mode.
|