I am new to MYSQL and am working with many to many tables and when I try to create the table I get 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 'rank INTEGER, year INTEGER, description TEXT, PRIMARY KEY(position_id), ' at line 4
Create call is
CREATE TABLE Position ( position_id INTEGER NOT NULL AUTO_INCREMENT, profile_id INTEGER, rank INTEGER, year INTEGER, description TEXT, PRIMARY KEY(position_id), CONSTRAINT position_ibfk_1 FOREIGN KEY (profile_id) REFERENCES Profile (profile_id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Everything looks clean so I'm not sure why I'm getting this error
According to P.Salmon, this is because of the name of the level. After looking at dev.mysql.com/doc/refman/8.0/en/keywords.html I changed the rank to
rank
and it worked.