title: Foreign key constraint not working
body: <p>I have created two tables with the following data</p>
  
  <p><img src="https://i.stack.imgur.com/xjHdk.png" alt="enter image description here"></p>
  
  <p>Script:</p>
  
  <pre><code>CREATE TABLE Persons
  (
  P_Id int NOT NULL,
  LastName varchar(255) NOT NULL,
  FirstName varchar(255),
  Address varchar(255),
  City varchar(255),
  PRIMARY KEY (P_Id)
  )ENGINE=InnoDB;
  
  CREATE TABLE Orders
  (
  O_Id int,
  OrderNo int,
  P_Id int NOT NULL,
  PRIMARY KEY (O_Id),
  FOREIGN KEY (P_Id) REFERENCES Persons(P_Id)
  ON DELETE CASCADE
  ON UPDATE CASCADE
  )ENGINE=InnoDB;
  
  INSERT INTO Persons VALUES
  (1, 'Last', 'First', 'Address', 'City');
  
  INSERT INTO Orders VALUES
  (1, 2, 1);
  
  DELETE FROM Persons WHERE P_Id = 1
  select * from Orders;
  </code></pre>
  
  <p>I have implemented this example in MySQL workbench (example taken from w3schools).</p>
  
  <p>Now on deleting the first row in the persons table, even the corresponding row from the Orders table is supposed to get deleted. i.e., the last row. But it is not getting deleted. </p>
  
  <p>Can someone tell me what i am missing here ? </p>
  
  <p>Still it shows the row in orders table. </p>