skip to Main Content

I am getting an error when i am trying to create a table in mysql command line as shown in the imageenter image description here

I was trying to create a table and got a syntax error 1064 stating I have an error in the syntax.

2

Answers


  1. There is an error in your SQL syntax. The CREATE statement does not contain a comma after the table name.

      CREATE TABLE favorite_food (
      person_id SMALLINT UNSIGNED,
      food varchar(20),
      PRIMARY KEY (person_id,food),
      FOREIGN KEY(person_id)  REFERENCES person (person_id)
      );
    
    Login or Signup to reply.
  2. CREATE TABLE favorite_food(
    person_id SMALLIT UNSIGNED,
    food VARCHAR(20),
    PRIMARY KEY (person_id,food),
    FOREIGN KEY(person_id) REFERENCES person (person_id));

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search