I am trying to insert data into a database I have designed, and am receiving an error 1452.
SOLVED.
As far as the error concerned most likely you don't have rows in one or all parent tables ( Customer
, Branch
, AccountTypes
) with PK values that you're trying to refer to in your INSERT
statement ( 1
, "40-20-23"
, "Current"
accordingly).
Insert these rows first
INSERT INTO Customer (FirstName, ...) VALUES(...);
INSERT INTO Branch (BranchSortCode, ...) VALUES('40-20-23', ...);
INSERT INTO AccountTypes (AccountType, ...) VALUES('Current', ...);
Here is SQLFiddle demo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.