Error: Sql query, create table statement

Avatar
  • Answered
I have created a script for creating a database in phpmyadmin, but when I import the script and run it, I get this error:
MySQL said: Documentation
#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 '--create the table
CREATE TABLE profile (
studentID INT NOT NULL AUTO_IN' at line 3

I have read through the questions and answers of such an error at this site, but none has helped in my case. I have tried changing the table name, and the type 'INT' to 'INT(11)'.
So here is the part of the script:

/*****************************************
* Create the students_personal_profiles database
*****************************************/
DROP DATABASE IF EXISTS students_personal_profiles;
CREATE DATABASE students_personal_profiles;
USE students_personal_profiles; -- MySQL command

--create the table
CREATE TABLE profile (
studentID INT NOT NULL AUTO_INCREMENT,
firstName VARCHAR(25) NOT NULL,
secondName VARCHAR(25) NOT NULL,
dateOfBirth DATE NOT NULL,
gender CHAR(2) NOT NULL,
email VARCHAR(30) NOT NULL,
PRIMARY KEY (studentID),
UNIQUE INDEX email (email)
);

Please help, thanks.
Avatar
Scott
Hello StellaM, This type of error message tells you where to start looking. It tells you near -- create table. This is usually the line that has the error in it. Comments should not run as part of the SQL query. This means that the comment you have starting with '--' should have been ignored. The error indicates that it may not have been for some reason. Go ahead and remove that comment line and then try again. If that was not the actual cause of the error, you will receive a different one that may be a bit more helpful. Kindest Regards, Scott M