Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Results 1 to 5 of 5
  1. #1
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Unhappy MySQL table definition frustrations...

    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

  2. #2
    roger's Avatar
    roger is offline Registered User
    Join Date
    May 2001
    Location
    UK
    Posts
    356
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wouldn't call a column Identity. It is likely to be a reserved word. Call it something else and see what happens.

    R.
    iBook SE Graphite OSX
    iMac DV+ OSX
    Airport Base Station
    20GB iPod
    Bluetooth and t68i

  3. #3
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts
    I thought that as well and it was the first thing I tried

  4. #4
    roger's Avatar
    roger is offline Registered User
    Join Date
    May 2001
    Location
    UK
    Posts
    356
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    iBook SE Graphite OSX
    iMac DV+ OSX
    Airport Base Station
    20GB iPod
    Bluetooth and t68i

  5. #5
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts
    DAMN ME AWWWW!

    My dyslexic brain didn't notice the semicolns which should be COMMAS.

    Thanks!

 

 

Similar Threads

  1. MySQL install problems
    By svenrg in forum Unix & X11
    Replies: 2
    Last Post: November 21st, 2002, 10:08 PM
  2. MySQL & StartupItems Problem
    By turbine in forum Unix & X11
    Replies: 2
    Last Post: September 27th, 2002, 10:44 PM
  3. php in os x server 10.1
    By banzai in forum Mac OS X System & Mac Software
    Replies: 5
    Last Post: June 12th, 2002, 04:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •