Search code examples
mysqlmysql-error-1064

#1064 error message - SQL syntax


All I am trying to do is create a simple database to store user information they submit off my website. Here is my code:

USE database_1; 

   CREATE TABLE contact_us (
   `id` INT NOT NULL AUTO_INCREMENT,
   `fname` VARCHAR(30) NOT NULL,
   `lname` VARCHAR(30) NOT NULL,
   `coName` VARCHAR(50) NOT NULL,
   `phone` VARCHAR(11) NOT NULL,
   `ext` VARCHAR(10) NOT NULL,
   `street` VARCHAR(50) NOT NULL,
   `city` VARCHAR(30) NOT NULL,
   `state` VARCHAR(30) NOT NULL,
   `zip` VARCHAR(10) NOT NULL,
   `email` VARCHAR(50) NOT NULL,
   `website` VARCHAR(50) NOT NULL,
   `inquiry` VARCHAR NOT NULL,
    PRIMARY KEY(id)
) ENGINE=INNODB;

Here is my error message:

#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 'NOT NULL, PRIMARY KEY(id) 
) ENGINE=INNODB' at line 14

I have checked/tried to make sure all commas and semicolons were in place, added a space between PRIMARY KEY (id), adding a space between ENGINE = INNODB;, and moving ENGINE=INNODB; down to its own line. I have looked over a ton of forums to see if I could figure it out myself but everything I have tried hasn't resolved my error. If anyone out there as any idea what I am doing wrong, your help would be greatly appreciated. Thank You


Solution

  • replace this

        `inquiry` VARCHAR NOT NULL,
    

    by

       `inquiry` VARCHAR(25) NOT NULL,
    

    you have to give VARCHAR LENGTH, i writed 25 you have to choose your length