Mysql foreign key constraint not working -


Hi guys, I'm just making a foreign key reference to the original table in a child table. When I try to remove the row from the original table, which is in the hair table, surprisingly it allows me to remove it. I have tried not to do any help by writing down the hair table and writing it without it too. Any ideas why this is happening? .Below code I am using while creating table

  make table area (ID int primary key AUTO_INCREMENT, name varchar (50) not NULL). Create table aggregator (ID primary primary key AUTO_INCREMENT, name varchar (50) NOT tap); Table Entry (ID int primary key AUTO_INCREMENT, name varchar (50) not NULL, region_id integer, aggregator_id integer, is_public boolean default 0 no null, foreign key (region_id) give context field (id), foreign key (aggregator_id) reference Create aggregator (id));    

"itemprop =" text ">

Both parents and baby table needs to be in the InnoDB table.

Try:

  Create table area (id int primary key AUTO_INCREMENT, name varchar (50) not NULL) engine = InnoDB; Create table aggregator (id int primary key AUTO_INCREMENT, name varchar (50) not NULL) engine = InnoDB; Table Entry (ID int primary key AUTO_INCREMENT, name varchar (50) not NULL, region_id integer, aggregator_id integer, is_public boolean default 0 no null, foreign key (region_id) give context field (id), foreign key (aggregator_id) reference Create aggregator (id) engine = INNODB;    

Comments