

Get in touch

Download Plugin Now
  • Follow
  • Follow
WP Data Access
  • Download
  • Support
  • Features
  • Pricing
  • Documentation
    • Tool Guide
    • App Builder
    • Data Explorer
    • SQL Query Builder
    • Plugin Settings
    • Legacy Tools
    • Remote Connections
a
M
  • Download
  • Support
  • Features
  • Pricing
  • Documentation
    • Tool Guide
    • App Builder
    • Data Explorer
    • SQL Query Builder
    • Plugin Settings
    • Legacy Tools
    • Remote Connections
Download Plugin Now

SQL Query Builder

  • Getting Started
  • Writing queries
  • AI Assistant
  • Schedule queries
  • Data exchange
  • WordPress user ID in SQL
  • Stored procedures
  • Database triggers
  • Visual Query Builder
View Categories

AI Assistant

The SQL Query Builder includes a built-in AI Assistant that helps you write, refine, and troubleshoot SQL queries — right from your WordPress dashboard. To use the assistant, you’ll first need to configure it with a ChatGPT API key.

Who Can Use the AI Assistant? #

The AI Assistant is available to both free and premium users. There are no extra charges from WP Data Access — we simply pass your request to ChatGPT and return its response. You only pay OpenAI for the usage of your own API key.

Getting Started #

When you launch the AI Assistant for the first time, you’ll be prompted to set up your connection:

  • If you already have a valid ChatGPT API key, just paste it into the dialog and you’re ready to go
  • If not, follow the steps outlined in section How to Get a ChatGPT API Key
SQL Query Builder - AI setup
SQL Query Builder - AI setup API key

How to Get a ChatGPT API Key #

To use the AI Assistant in the Query Builder, you need a valid ChatGPT API key from OpenAI.

  1. Go to the official OpenAI API page:
    https://platform.openai.com/account/api-keys
  2. Log in with your OpenAI account, or create a free account if you don’t have one yet
  3. Click the “Create new secret key” button to generate your API key
  4. Copy the key and paste it into the setup dialog when launching the AI Assistant for the first time

Note: Keep your API key safe and never share it publicly. You will be billed directly by OpenAI for your usage. The plugin does not charge or log your key.

Switch API key #

Want to switch API keys later? Click Settings from the toolbar menu and choose Update ChatGPT API Key to enter a new one.

Note: ChatGPT API keys are stored per user, so each admin can use their own key.

Secure Your API Key (Recommended) #

For extra security, you can store your API key in encrypted format by adding the following constant to your wp-config.php:

define('WPDA_ENCRYPT_AI_KEY', 'enter-your-32-character-strong-random-string-here');

Using the AI Assistant #

Once an API key is set, just click the AI Assistant icon on the query toolbar to get started. The assistant supports both gpt-3.5-turbo and gpt-4-turbo models.

  • Click the hint icon to learn how to formulate effective questions
  • Enable the explanations icon to include step-by-step reasoning in responses

You can:

  • Copy full responses or SQL queries to your clipboard
  • Insert queries directly into the editor (this will overwrite current content)
  • Add table definitions to improve the quality of the generated SQL

To add table definitions:

  • Click Add Table Definitions
  • Click inside the Table List
  • Select the relevant tables for your query

Example #

  • Write a query to select the average and total salaries of all employees per department
  • Use gpt-3.5-turbo model
  • Add explanations
  • Added table definitions for tables dept and emp
SQL Query Builder – AI

AI-Powered Error Fixes #

If a query throws an error and ChatGPT is configured, an AI icon will appear in the message bar. Click it to send the error details to ChatGPT for troubleshooting. You can also attach table definitions to give ChatGPT better context and improve its suggestions.

Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on 2025-05-22
Writing queriesSchedule queries

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • Who Can Use the AI Assistant?
  • Getting Started
  • How to Get a ChatGPT API Key
  • Switch API key
  • Secure Your API Key (Recommended)
  • Using the AI Assistant
  • Example
  • AI-Powered Error Fixes
WP Data Access
  • Follow
  • Follow
Quick Links
$

Blogs

$

Tutorials

$

Demos

Get in touch
$

Premium support

$

Free support forum

$

Contact us

Resources


WordPress plugin directory



YouTube tutorials

Copyright © 2025 | All Right Reserves

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok