Sample Header Ad - 728x90

MySQL gives Unknown column error when forward engineering database from diagram

0 votes
1 answer
107 views
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:
SQL script in server
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 by SlowlySwift (5 rep)
Jun 18, 2023, 03:22 AM
Last activity: Jun 18, 2023, 04:36 AM