How to copy table between two models in Mysql workbench?

If you just want to do a single table through the MySQL Workbench. In MySQL Workbench: Connect to a MySQL Server Expand a Database Right Click on a table Select Copy To Clipboard Select Create Statement A create statement for the table will be copied to your clipboard similar to the below: CREATE TABLE `cache` … Read more

MySQL Foreign Key Error 1005 errno 150 primary key as foreign key

When creating a foreign key constraint, MySQL requires a usable index on both the referencing table and also on the referenced table. The index on the referencing table is created automatically if one doesn’t exist, but the one on the referenced table needs to be created manually (Source). Yours appears to be missing. Test case: … Read more

Error Code: 1062. Duplicate entry ‘1’ for key ‘PRIMARY’

The main reason why the error has been generated is because there is already an existing value of 1 for the column ID in which you define it as PRIMARY KEY (values are unique) in the table you are inserting. Why not set the column ID as AUTO_INCREMENT? CREATE TABLE IF NOT EXISTS `PROGETTO`.`UFFICIO-INFORMAZIONI` ( … Read more