MySQL table definition frustrations...

michaelsanford

Translator, Web Developer
I lost my book on MySQL (well it's somewhere in the warehouse under a pile of couches...)

I'm trying to create a table using the attached script, and for some reason, I keep getting the error [gwailo:~/documents/neads]% mysql < create_table.sql
ERROR 1064 at line 1: You have an error in your SQL syntax near '' at line 3


"Identity CHAR(12)" is a radio button, not a primary key (well a second one). I can't see any missing semicolons or parenthesis, and I'm following the code as indicated exactly in the online MySQL manual (at least I think I am). Any insight would be appreciated!

Code:
CREATE TABLE conf_eval
(
unique_identifier INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT;       
Identity CHAR(12);
First_conference CHAR(3);
Compared_to_previous CHAR(14);
Compared_to_previous_comments TEXT;
Overall_rating CHAR(14);
Overall_comments TEXT;
Workshop_speakers CHAR(14);
Workshop_comments TEXT;
.
.
.
Info_needed_before_ottawa_comments TEXT;
Accessibility_problems_comments TEXT;
Liked_most_comments TEXT; 
Liked_least_comments TEXT;   
Future_topics_comments TEXT;
Overall_comments TEXT;
)\g
 
I wouldn't call a column Identity. It is likely to be a reserved word. Call it something else and see what happens.

R.
 
I modified the code a bit to get it working:

CREATE TABLE conf_eval (unique_identifier INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Identity_1 CHAR(12),
First_conference CHAR(3),
Compared_to_previous CHAR(14),
Compared_to_previous_comments TEXT,
Overall_rating CHAR(14),
Overall_comments_1 TEXT,
Workshop_speakers CHAR(14),
Workshop_comments TEXT,
Info_needed_before_ottawa_comments TEXT,
Accessibility_problems_comments TEXT,
Liked_most_comments TEXT,
Liked_least_comments TEXT,
Future_topics_comments TEXT,
Overall_comments_2 TEXT);

Note that you had two fields called Overall_comments. I have added a suffix to each to distinguish them. This code runs fine on my MySQL database through PHPAdmin.php.

R.
 
Back
Top