I've put the following text in DB Fiddle to try to debug it. The error is below
Results Schema error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax check the manual that corresponds to your MySQL server version for the correct syntax to use near & # 39; references frequentVisitorCoupons_coupons (couponId) on delete cascade) & # 39; to line 9 // the SQL for this error (the first table is referenced in the // 2nd where the error is CREATE TABLE IF NOT EXISTED frequentVisitorCoupons_coupons ( couponId mediumint non null auto_increment unique, primary key (couponId), totalHits mediumint non null, isText boolean not null, imageUrl text (1000) ) CREATE TABLE IF NOT EXISTS frequentVisitorCoupons_targets ( targetId mediumint non null auto_increment unique, primary key (targetId), isSitewide tinyint (1) is not null, targetUrl varchar (500), displayThreshold tinyint (5) not null by default 20, offerCutoff tinyint (5), fk_coupons_targets mediumint non-unique, the foreign key fk_coupons_targets refers to frequentVisitorCoupons_coupons (couponId) when removing the cascade )
A flawless stay
This is my first attempt at foreign keys. What am I doing wrong above?