Last answered:

17 May 2023

Posted on:

12 Nov 2021

1

Resolved: foreign key : able to see foreign key in the table sales DDL tab , but the Foreign Keys tab is empty

CREATE TABLE `sales` (
  `purchase_id` int NOT NULL AUTO_INCREMENT,
  `date_of_purchase` date DEFAULT NULL,
  `customer_id` int DEFAULT NULL,
  `item_code` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`purchase_id`),
  KEY `constraint_1` (`customer_id`),
  CONSTRAINT `constraint_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `customers` (
  `customer_id` int NOT NULL AUTO_INCREMENT,
  `first_name` varchar(255) DEFAULT NULL,
  `last_name` varchar(255) DEFAULT NULL,
  `email_address` varchar(255) DEFAULT NULL,
  `number_of_complaints` int DEFAULT NULL,
  PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

7 answers ( 2 marked as helpful)
Instructor
Posted on:

14 Nov 2021

1

Hi Harsha!

Thanks for reaching out.

After creating the tables, can you please click on the tiny refresh schema icon in the bottom-left part of the screen, and then retry checking the DDL tab?
image
If this doesn't help, I am afraid that the error may reflect a bug associated to one of the recent MySQL Workbench versions. Nevertheless, please support your question with screenshots if that is the case, so that we can try to assist you better.
Hope this helps.
Best,
Martin

Posted on:

05 Nov 2022

0

image

I have the same problem. It shows up in DDL and schemas but not in FK section (I click the refreshed button on the bottom right corner). Also if I may ask too, I made sure to select ON Update NO Action but why does it show ON UPDATE Restrict on the definition? I appreciate the response!

Posted on:

05 Nov 2022

0

I have the same problem, I can't find the foreign key in the foreign keys tab, any solution, please?

Instructor
Posted on:

09 Nov 2022

3

Hi Gilliane and Mohamed!
Thanks for reaching out.

This is a well-known bug in the Workbench. You can continue with the smooth taking of the course.

Hope this helps.
Best,
Tsvetelin

Posted on:

09 Nov 2022

0

Thanks for your reply, appreciated.

Posted on:

13 Apr 2023

0

Hi everyone,

Just want to make sure that, the bug still remains !?

Thanks!


Instructor
Posted on:

17 May 2023

0

Hi Chun Hsien!


Thanks for reaching out and please excuse us for the belated answer.


If the bug persists for too long, please reload Workbench and reload the database. This should hopefully solve the issue but please feel free to get back to us should you need further assistance. Thank you.


Kind regards,
Martin

Submit an answer