I cannot create a table and including a Foreign Key in Mysqlversion5.5

Avatar
  • Answered
When I write my SQL commands CREATE TABLE CONTRIBUTION(ID INT NOTNULL,M_ID INT NOTNULL,DATE DATE,AMOUNT VARCHAR(30),Foreign Key(ID) References MEMBERS(ID));
Avatar
Scott
Hello Hamphrey, Sorry to hear you are having issues creating tables with your MySQL. The error message you are getting is not due to the Foreign Key, but it is simply a syntax error. You can learn more about MySQL 1064 errors here. In checking on the official MySQL 5.5 site for CREATE TABLE it seems NOTNULL is not the correct term. It should be NOT NULL (with a space). Give that a try and it should take care of this particular error message. Kindest Regards, Scott M