Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

Tips

Getting an AI to explain or fix a query in Base by Zaweba

Explain this query and Fix this query in Base by Zaweba send the open query's SQL, and any error, to your own AI account and offer the reply to apply.

Getting an AI to explain or fix a query in Base by Zaweba

Queries have a way of outliving the memory of why they were written. You open one six months later and can't remember what it was meant to leave out, or you inherit a database from someone else with forty queries and no notes. Sometimes a query you've just written stops with an error that makes no sense. Base by Zaweba has two AI helpers for exactly these moments: Explain this query and Fix this query.

Both use your own AI account, connected through Base's AI settings. Without one, the AI menu stays greyed out and Base works as normal.

Explain this query

Explain this query sends the open query's SQL to your AI and shows the reply: a plain English account of what the query does. Which tables it reads, how they are joined, what the conditions keep and leave out, and how the results are grouped and sorted.

It is useful for learning as well as for remembering. If you have built queries in the designer and wondered what the SQL tab means, explaining a few of them is a gentle way to start reading it. It is also a good check on your own work. If the explanation says "customers in Leeds or anyone in York", and you meant active customers in both, an Or row is missing a condition.

Fix this query

Fix this query sends the SQL together with the error Base gave when it tried to run it. Base shows the AI's reply, usually a corrected version of the SQL, with buttons to apply it.

Typical problems it helps with are a misspelt field name, a missing bracket in an expression, or a condition on a calculated column written the wrong way. Each is easy to spot once someone points at it and maddening until they do.

Applying a suggestion with care

Don't apply a fix blindly. Read what the AI changed and why. Then run the query and look at the results. A query that runs without an error isn't necessarily a query that gives the right answer, and a fix that silently drops a condition can turn an error into a wrong total, which is worse.

If the fix is close but not quite right, apply it and adjust it yourself in the designer or the SQL tab. If the explanation still doesn't make sense, ask again with a more specific description of what the query is supposed to do.

What the AI sees

Explain and Fix send the query's SQL, and for Fix the error message. As with Base's other AI features, what goes to the provider is otherwise the database's design (table and field names, types, rules and relationships) so the AI understands the context. Records are only sent if you tick Include sample rows, which starts off every time.

Alongside the query designer

These two helpers sit beside the query designer and its SQL tab, not instead of them. Most queries need neither: you build them visually and they work. The helpers earn their place on the awkward ones, the inherited ones and the ones that fail with a message you can't decode.

Used that way, they shorten the time between "why won't this run?" and a working query, and you understand a little more of your own database each time.