0

I have a MySQL EER diagram the I forward engineer into a database. I also use the forward engineer feature to generate insert statements for data automatically. After entering about 120 rows of data I forward engineered the database only for it to give an error:

ERROR: Error 1054: Unknown column 'XX' in 'field list'
SQL Code:
 INSERT INTO `mydb`.`Person` (`Person_ID`, `SSN`, `FirstName`, `MiddleName`, `LastName`, `Gender`, `Race`, `MaritalStatus`, `Military`, `Note1`, `Note2`, `DOB`) VALUES (111, 'xxx-xx-xxxx', 'John', 'K', 'Smith', 'M', 'XX', 'XX', XX, 'Case_1', NULL, NULL) 

I don't understand what the problem is; I'm using the forward engineer feature so none of the column names can be misspelled. Is this just a bug?

I'm using MySQL Workbench 8.0.31 if that helps. I know it isn't the latest version, but I downgraded because I encountered crashes while querying in the new version.

Update: J.D helpfully pointed out that the field didn't have quotes and from there I was able to find the problem. The Military field was a TinyInt and therefore wasn't being given quotation marks, but the data being inserted was a string; hence the error.

asked Jun 18, 2023 at 3:22
0

1 Answer 1

0

Well your issue is the following part in bold: 'XX', XX, 'Case_1' because it lacks single quotes. Not sure why a built-in auto-generation tool is doing that though. Maybe a bug in the old version of MySQL Workbench, that you're using.

answered Jun 18, 2023 at 4:02
4
  • Thanks, nice catch. Commented Jun 18, 2023 at 4:10
  • Since there's hundreds of rows it's not really practical to fix each one by hand. Instead I'm gonna see if setting that field to null does the trick. Commented Jun 18, 2023 at 4:15
  • I appreciate the help Commented Jun 18, 2023 at 4:15
  • @SlowlySwift No problem, glad to help! Commented Jun 18, 2023 at 4:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.