Skip to main content

Creating a Query

A saved query pairs a piece of SQL with a database connection and a name. Once saved, it can be run, shared, scheduled, and put on dashboards.

Steps

  1. From the Queries view, choose Add query (or open the editor).
  2. Select a connection — the database the query runs against.
  3. Write your SQL. The editor provides schema-aware autocomplete for your tables and columns. See Writing SQL.
  4. Run it to confirm it returns what you expect.
  5. Name and save the query.
Free plan limit

A group on the Free plan can hold up to 3 saved queries. Upgrade to Power for unlimited queries — see Plans and limits.

GET-style vs. POST-style queries

Kvery classifies a query by its leading SQL keyword, which affects how it can be run and exposed:

  • Read queries start with SELECT or EXEC (and WITH for CTEs). These are treated as safe-to-read and are callable over GET.
  • Write queries start with INSERT, UPDATE, DELETE, REPLACE, ALTER, or CREATE. These modify data and are exposed over write methods (POST/PUT/PATCH/DELETE) when published as an API.

This classification is automatic — you do not configure it manually.

Adding parameters

To make a query reusable, turn values into input fields with form variables:

SELECT *
FROM orders
WHERE status = :status
AND created_at >= :from_date;

Kvery detects :status and :from_date and renders form fields for them. See Form variables for field types, defaults, and validation.

After saving

Once saved, your query appears in the Queries list. From there you can choose a result layout, enable sharing, set up a schedule, or add it to a dashboard.

Stage risky changes as a draft

If you need to edit a query that is already live (shared or used on a dashboard), consider using a draft so your changes are not published until you are ready.