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?)
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`;
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!
I uploaded a .csv file then used the designer and the query builder to make a table. When I attempted to execute the query, I received a syntax error. Here is the query:
CREATE TABLE `CreationResourceCatalog`
(`ID` smallint(4) NOT NULL
,`Title` varchar(50) NOT NULL
,`Ministry` varchar(50) NOT NULL
,`Description` varchar(1000) NOT NULL
,`Link` varchar(100) NOT NULL
,`Summary` varchar(1000) NOT NULL
,`Science` varchar(50) NULL
,`Age` varchar(50) NOT NULL
,`Key_Word` varchar(500) NULL
,`MBC_Flag` boolean(1) NOT NULL
) ENGINE InnoDB DEFAULT CHARACTER SET latin1 COLLATE=latin1_swedish_ci;
Any help you can provide will be greatly appreciated. Thank you.
Hi Sandra,
Could you try the following in the Query Builder instead:
CREATE TABLE `CreationResourceCatalog`
(`ID` smallint(4) NOT NULL
,`Title` varchar(50) NOT NULL
,`Ministry` varchar(50) NOT NULL
,`Description` varchar(1000) NOT NULL
,`Link` varchar(100) NOT NULL
,`Summary` varchar(1000) NOT NULL
,`Science` varchar(50) NULL
,`Age` varchar(50) NOT NULL
,`Key_Word` varchar(500) NULL
,`MBC_Flag` boolean NOT NULL)
Alternatively, you can design and create the table in the Data Designer too. Here’s a tutorial: https://share.zight.com/bLuQGK0r
Let us know how it goes. Feel free to message us using the form here if you have other questions. 🙂