WP Data Access
  • Download
  • Support
  • Features
  • Pricing
  • Documentation
Select Page
Popular Search formimportqueryshortcodesql

WP Data Access

  • Getting started
  • Installation
  • What’s new?
  • Patches
  • Known limitations
  • FAQ

Data Tables

  • Getting Started
  • Creating and publishing
  • Responsive data tables
  • SEO friendly data tables
  • Adding hyperlinks
  • Extension Manager
  • Style Manager
  • Language settings
  • Styling
    • Style Manager
    • Premium styling
    • Global styling
    • Code Manager Styling
    • Manual styling
    • Styling issues
  • Filters
    • Static filters
    • Interactive filters
      • URL parameters
      • Search Panes
      • Search Builder
      • Search form
      • Advanced search
      • Geolocation search
  • Export & other buttons
    • Export to PDF, CSV, Excel, SQL
    • Print & copy buttons
    • Column selection buttons
    • Custom buttons
  • Advanced features
    • Advanced settings
    • Large tables & performance
    • Progressively SHOW MORE
    • Custom queries
    • Custom Post Types
    • Row grouping
    • Responsive master-detail
    • Master-detail tables
    • Non admin user access
  • Demos & tutorials
    • Demos
    • Tutorials

Data Apps

  • Data Projects
  • Projects and templates
  • Supported Data Types
  • One-To-Many relationships
  • Many-To-Many relationships
  • Registration page
  • Manage table options
  • Shortcode usage
  • Project Templates
    • Project Templates
    • Creating templates
    • Table Settings
    • Relationships
    • List Table
    • Data Entry
    • Reconcile
  • Data Forms
    • Data Forms
    • Overview
    • Project Demo
    • Page Demo
  • Advanced features
    • Adding filters
    • Custom validation
    • Add less/more button
    • User roles
    • Managing roles and users
    • Advanced table options
    • Advanced lookups
    • Front-end toolbar
    • Transfer to other WP site
  • Demos & tutorials
    • Demos
    • Tutorials

Data Explorer

  • Getting started
  • Navigation
  • Explore tables & views
  • Manage tables & views
  • Naming conventions
  • Manage Actions
    • Actions
  • Manage Settings
    • Settings
    • Table Settings
    • Column Settings
    • Search Settings
    • Geolocation Settings
    • Dynamic Hyperlinks
    • Dashboard Menus
  • Data Management
    • Import CSV & SQL files
    • Run SQL script files
    • Data Backup
  • Problems & solutions
    • InnoDB #rows estimation
    • Import file too large
    • Transfer to other WP DB

Remote Databases

  • MySQL | MariaDB
  • Other DBMS
    • Heterogeneous Connections
    • Using ODBC | JDBC
    • Connect to SQL Server
  • Premium Data Services
    • Remote wizard
    • START HERE
    • Errors and messages
    • Limitations
    • Tutorials
    • Remote Databases
      • Remote databases
      • SQL Server
      • PostgreSQL
      • Oracle
      • MariaDB | MySQL
    • Remote Data Files
      • Remote data files
      • CSV files
      • JSON files
      • MS Access
      • XML files
      • Public URL
      • Synchronization
    • Advanced features
      • Performance
      • Indexes

SQL

  • Getting Started
  • Tutorials
  • Visual Query Builder
  • Writing queries
  • Data exchange
  • Stored procedures
  • Database triggers
  • Scheduled queries

Business Intelligence

  • Getting started
  • Dashboards
  • Sharing dashboards
  • Dashboards Widgets
    • Dashboard Widgets
    • Publication Widget
    • Project Widget
    • Chart Widget
    • Custom Code Widget
    • Database Widget
    • Sharing Widgets

Table Design

  • Getting started
  • Introduction
  • Basic mode

Plugin Settings

  • Getting started
  • Plugin
  • Back-end
  • Front-end
  • Dashboard
  • Data Forms
  • Data Tables
  • Data Backup
  • Uninstall
  • Manage Repository
  • Manage Roles
  • System Info

Code

  • Shortcodes
    • Overview
    • wpdataaccess
    • wpdadataproject
    • wpdadataforms
    • wpdadiehard
    • wpdageomap
    • wpdawidget
  • Plugin Variables
    • WordPress user ID in SQL
    • Environment variables
  • Hooks & filters
    • Overview
    • Hooks
      • Overview
      • wpda_add_search_actions
      • wpda_add_search_filter
      • wpda_before_list_table
      • wpda_after_list_table
      • wpda_wpdataaccess_prepare
    • Filters
      • Overview
      • wpda_column_default
      • wpda_before_simple_form
      • wpda_after_simple_form
      • wpda_construct_where_clause
  • API
    • WP Data Access API
    • Remote database access
    • CRUD Example
    • Extensions
      • Alternative search algorithm
      • Alternative buttons extension
  • Code Manager
    • Overview
    • Write code
    • Share(d) code

Run SQL script files

Button Import data/Execute script(s) can be used to execute SQL script files. It allows DCL (grant or revoke access), DDL (e.g. create table, drop table) and DML (select, insert, update, delete) statements, presuming the connected user has the proper privileges (works for remote databases as well).

SQL script files may contain multiple SQL statements. There is one important rule:

Every SQL statement must end with a ; and a new line #

If you receive a message that your SQL file was successfully processed and you are not seeing any results, this is mostly because one or more SQL statements do not end with a ; and a new line.

If your SQL file is too long, you might not be able to upload it. Instead, you can add your SQL file to a ZIP file and upload the ZIP file.

You can also bundle multiple SQL files in a ZIP. This can be very useful, for example, if you want to copy tables, projects and/or publications from your development machine to a production environment. Be aware, that you have no influence on the order in which SQL files are processed. Make sure there are no dependies between SQL file within one ZIP file.

Be CAREFUL! Know what you do! Do what you know! If you have never written any SQL before, don’t start experimenting here. If you corrupt a WordPress table, you might need to restore your backup… (Do you have one? Right now?)

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

How can we help?

Updated on 2022-12-06
Import CSV & SQL filesData Backup

2 Comments

  1. Diane L Rupp
    Diane L Rupp on 2023-10-02 at 2:25 pm

    I am trying to execute a create view statement. When I execute the statement without “;” it states that it was successful, but I do not see the view listed anywhere. When I insert “;” at the end or as it is shown there is an error that the script has failed. How do I get this script to execute properly?
    Thank you for your help.
    This is the script as I have it now —
    create view `cm_section_resources` as
    select `CMBooks`.`ResDisplay` as `ResDisplay`
    , `CMBooks`.`BuyAmazon` as `BuyAmazon`
    , `CMBooks`.`ReadOnline` as `ReadOnline`
    , `CMWorksLink`.`BookID` as `BookID`
    , `CMWorksLink`.`SectionID` as `SectionID`
    from `CMWorksLink`;

    left join `CMBooks` on `CMWorksLink`.`BookID` = `CMBooks`.`BookID`;

    Reply
    • Kim Leong
      Kim Leong on 2023-10-03 at 4:12 am

      Hi Diane,

      Are you creating the view in a specific database? See here: https://share.zight.com/Blu2OBzZ

      Please send us a message via our Contact page so we can take a closer look at the issue.

      We’ll wait for your message!

      Reply

Submit a Comment Cancel reply

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

Table of Contents
  • Every SQL statement must end with a ; and a new line

Links

Blogs
Tutorials
Demos

Socials

LinkedIn
Twitter

Get in touch

Premium support
Free support forum
Contact us

Resources

WordPress plugin directory
YouTube tutorials

Passionate Programmers B.V. © 2017 - 2023 All rights reserved