How do I write a query?
Choose File › New Query, write a SELECT statement, and press ⌘↩ to run it.
- Choose File › New Query, or click + beside Queries in the sidebar.
- Name it in the Untitled query field at the top.
- Write SQL in the editor. The Schema list shows what you can read, such as
v_notesandv_tags. For example:SELECT title, updated FROM v_notes ORDER BY updated DESC. - Press ⌘↩, or click Run query, to see the results.
- 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.