Search code examples
mysqldatabase-designmysql-error-1064

Sea Quail Generated MySQL SQL Data causes #1064 SQL Error


At the site Sea Quail Database Diagram Tool which is great for creating database diagrams I just created a MySQL database schema diagram - very basic one to get a feel of it.

I created the script to run from PHPMyadmin to add this all to a database created there to see if importing would work OK, but I ran into this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--------------------------------------------------------------------------------' at line 2

Here is a snippet of the SQL data that was generated for me.

    -- Create Table: name_fields
--------------------------------------------------------------------------------
CREATE TABLE name_fields
(
    `` VARCHAR(250)  NULL 
)
ENGINE=INNODB



-- Create Table: name_api
--------------------------------------------------------------------------------
CREATE TABLE name_api
(
    `` VARCHAR(250)  NULL 
)
ENGINE=INNODB



-- Create Table: name_users
--------------------------------------------------------------------------------
CREATE TABLE name_users
(
    `ID` BIGINT  NULL 
    ,`user_login` VARCHAR(250)  NULL 
    ,`user_name` VARCHAR(250)  NULL 
    ,`user_password` VARCHAR(250)  NULL 
)
ENGINE=INNODB



-- Create Table: name_options
--------------------------------------------------------------------------------
CREATE TABLE name_options
(
    `` VARCHAR(250)  NULL 
)
ENGINE=INNODB



-- Create Table: name_ideal

Not sure what is wrong with the syntax here. Is there an easy way to debug this in MySQL?


Solution

  • Yes you have syntax error

    First of all the

    -- Create Table: name_fields
    -------------------------------------------------------------------------------
    

    Should be in one line you need to check this

    something like

    -- Create Table: name_fields  ------------------------------------------------------
    

    2nd thing

    CREATE TABLE name_fields
    (
        `` VARCHAR(250)  NULL 
    )
    ENGINE=INNODB
    

    Where is the column name ? you have just specified ``. The same is for name_api table too, correct these and it should work.