

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
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

Writing queries

NOTE: You must be an admin user to use the Query Builder.

The SQL Query Builder launches with an empty tab, ready for a private query. Write your SQL commands in the editor below the tab. Then:

  • Select a database from the dropdown
  • Click the “Execute query” icon button
  • Click the “Save query” icon to save your query
SQL Query Builder - writing queries

Create a new query #

To create a new query, click the “Menu” icon in the toolbar and choose:

  • Private Query → visible only to your user account
  • Global Query → accessible to all admin users

Open an existing query #

Click the “Menu” icon and select Open. You’ll see a dialog with your saved private and global queries. Simply select and load the one you need.

SQL Query Builder - open

Multiple SQL commands #

The Query Builder supports not only SELECT queries but all SQL commands (DCL, DDL, DML) — provided your user privileges allow it. Note: If you’re on shared hosting, your permissions may be restricted.

Separate multiple SQL statements using a line with just a forward slash /. Example:

drop table if exists x
/

create table x
(x int)
/

insert into x values(1)
/

insert into x values(2)
/

update x
set x = x + 100
/

select *
from x
/

Multiple queries #

Each command opens in its own tab and shows the results or response for that statement.

SQL Query Builder - tabs

User defined variables and dynamic queries #

You can use user-defined variables and build dynamic SQL queries in the Query Builder. Here is an example:

SET @column = "columnname"
/

SET @table = "tablename"
/

SET @select = CONCAT("SELECT ", @column, " FROM ", @table)
/

PREPARE stmt FROM @select
/

EXECUTE stmt
/
  • Read more about user defined variables

Query Parameters #

You can run or schedule a query with different parameter values using query parameters. Click the “Add Parameters” button. In the dialog, define a name and value for each parameter.

SQL Query Builder - params

WordPress Table Protection #

To keep your site safe, WordPress tables are protected by default. It is generally not possible to DROP, ALTER, or TRUNCATE WordPress core tables.

Database response #

A scrollable table below the editor displays the result of your query. You can export this data to CSV, JSON and XML.

View raw output #

Click the SERVER RESPONSE tab to view the raw database output. The output is shown in JSON format and is read-only.

Save query #

Click the “Save query” icon button to save a query. Alternatively, use the control/s keys from within the editor.

Query context menu #

Each query tab comes with its own context menu, accessible via the three-dots icon button at the end of the tab toolbar. This menu provides quick access to essential actions to manage your query efficiently:

  • Rename your query for easier identification
  • Delete a query you no longer need
  • Schedule execution at defined intervals
  • Load from file to import saved SQL commands
  • Save to file for local backups or version control
  • Copy to clipboard to paste your SQL elsewhere
  • Close the query tab when you’re done

These options help streamline your workflow and offer added flexibility for managing your SQL tasks directly from the WordPress dashboard.

SQL Query Builder - query context menu

Execution time #

To display SQL execution time (in parentheses after each result), add the following lines to your wp-config.php file:

define( 'WP_DEBUG_LOG', true );
define( 'SAVEQUERIES', true );
Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on 2025-05-22
Getting StartedAI Assistant

Submit a Comment Cancel reply

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

Table of Contents
  • Create a new query
  • Open an existing query
  • Multiple SQL commands
  • Multiple queries
  • User defined variables and dynamic queries
  • Query Parameters
  • WordPress Table Protection
  • Database response
  • View raw output
  • Save query
  • Query context menu
  • Execution time
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