AI Assistant

DbSchema includes a built-in AI Assistant that helps you work with your database faster — whether you need to write a SQL query, understand a table structure, or get design suggestions for your schema.

AI Assistant panel in DbSchema

How to Access

The AI Assistant can be opened in two ways:

  • From the menu: Tools → AI Assistant
  • From the SQL Editor toolbar — click the AI prompt button to send the current query or a question directly to the assistant

The assistant is disabled by default. You can activate it by starting a free trial via your DbSchema account, or by supplying your own API key in Settings → AI Assistant.

What the AI Assistant Can Do

  • Generate SQL queries from natural language — describe what you want and get ready-to-run SQL.
  • Explain SQL — paste any query and ask for a plain-English explanation of what it does.
  • Schema help — ask for normalization tips, index recommendations, or naming convention advice.
  • Answer database questions — how a SQL construct works, what a built-in function does, syntax examples.
  • Data generator patterns — ask the assistant to suggest regex or expression patterns for the Data Generator.

Generating SQL Queries — Examples

Type your request in plain English in the AI chat panel. For example:

  • "Show all orders placed in the last 30 days with the customer name and total amount."
  • "Count products per category, ordered by count descending."
  • "Find customers who have never placed an order."
  • "Write an UPDATE that sets status to 'inactive' for users who haven't logged in for 90 days."

The assistant generates SQL tailored to your schema (see Schema Context below). Copy the result directly into the SQL Editor and run it.

Schema & Design Assistance

You can ask the AI Assistant for help with schema design decisions:

  • "Should user addresses be stored in a separate table?"
  • "What indexes would speed up this query?"
  • "Generate a table structure for a blog with posts, categories, and tags."

The assistant can also produce CREATE TABLE statements that you can review and merge into your design model using the diagram editor.

Schema Context

For best results, the AI Assistant uses your open design model as context — it knows your table names, column names, types, and relationships. This allows it to generate accurate SQL and relevant suggestions specific to your actual database, rather than generic examples.

You can control which tables are included in the context from the AI Assistant panel. For large schemas, focus the context on the tables relevant to your current question to get more precise answers.


See also: SQL Editor · Data Generator · Automation Scripts