Unanswered: Does mySQL supports varchar as Primary key?
I had been facing problems in creating mysql using foreign key.
The problems falls on the userID foreign in Combination. They prompt me error (Error 1064: You have an error in your sql syntex. Check the manual that corresponds to your mySQL server version for the right syntex use near 'User(userID) ON UPDATE CASCADE ON DELETE CASCADE) TYPE=INNODB'). This problem does not occur when i create other tables. Thus it should not be syntex error. I would appretiate if somebody could help me to solved it. Thank alot. =)
CREATE TABLE User
userID VARCHAR(255) NOT NULL,
PRIMARY KEY(userID)) TYPE=INNODB;
CREATE TABLE Combination
coID INT NOT NULL AUTO_INCREMENT,
itemID INT NOT NULL,
FOREIGN KEY(itemID) REFERENCES Items(itemID) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY(userID) REFERENCES User(userID) ON UPDATE CASCADE ON DELETE CASCADE) TYPE=INNODB;