Help ERROR 1064

Discussion in 'MySQL' started by LongBeachIsland, Oct 30, 2011.

  1. #1
    Hi obviously I am not that familiar with my sql but I am trying to follow a tutorial. I am using the terminal and I am 99% sure I have written everything into the terminal as described but I keep getting the following error;

    ERROR 1064 (42000): 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 '('id'
    )


    now the only thing that comes to mind is that the tutorial was using mysql 5.0.27 I am using 5.1.53

    anyway here is the exact code I am writing to it

    mysql> CREATE TABLE subjects(
    -> id int(11) NOT NULL auto_increment,
    -> menu_name varchar(30) NOT NULL,
    -> position int(3) NOT NULL,
    -> visible tinyint(1) NOT NULL
    -> PRIMARY KEY ('id')
    -> );
    ERROR 1064 (42000): 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 '('id'
    )


    If anybody can help that would be great
     
    LongBeachIsland, Oct 30, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Put a comma after visible tinyint(1) NOT NULL, and get rid of the apostrophies around id. Either use backticks `id` or nothing.
     
    jestep, Oct 31, 2011 IP