How do I write a query?

Choose File › New Query, write a SELECT statement, and press ⌘↩ to run it.

Checked against Terra 0.1.0
  1. Choose File › New Query, or click + beside Queries in the sidebar.
  2. Name it in the Untitled query field at the top.
  3. Write SQL in the editor. The Schema list shows what you can read, such as v_notes and v_tags. For example: SELECT title, updated FROM v_notes ORDER BY updated DESC.
  4. Press ⌘↩, or click Run query, to see the results.
  5. Click Save query. It appears under Queries in the sidebar.

Shortcut: ⌘↩ runs the query while you're typing in the editor.

Other ways

  • Describe what you want in the line under the name, such as "notes tagged project", and click Generate. Your AI provider writes the SQL. Read it before you run it.
  • Tools › Run Query runs the query in the focused pane.

Good to know

  • Queries only read. They can't change your notes.
  • View switches between Query, Results, Sheet and Chart.
  • Export results as Markdown copies the results as a table, ready to paste into a note.
  • Open as Database makes a database from the notes the query found. Save the query first.