Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Unanswered: Newbie Problems (mostly syntax errors)

    When I try to create a table I get a 1064 syntax error:
    DROP TABLE IF EXISTS sandwiches;
    CREATE TABLE sandwiches
    (
    sandwichid INT(3) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    sandwichname VARCHAR(20) UNSIGNED NOT NULL,
    description VARCHAR(50),
    image_name VARCHAR(30)
    );

    I also get the same error for this table:
    DROP TABLE IF EXISTS origins;
    CREATE TABLE origins
    (
    image_name VARCHAR(20) UNSIGNED NOT NULL,
    origin VARCHAR(20),
    price DECIMAL(5,2),
    PRIMARY KEY(image_name)
    );

    When I change image_name to INT, it doesn't give this error but image_name needs to be VARCHAR.
    Last edited by gymangel812; 04-19-10 at 23:37.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    VARCHARs do not allow the UNSIGNED option... think about it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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