简体   繁体   English

MySQL错误1452插入数据

[英]MySQL Error 1452 Inserting Data

I am trying to insert data into a database I have designed, and am receiving an error 1452. 我试图将数据插入我设计的数据库中,并收到错误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). 至于与错误有关的问题,您很可能在一个或所有父表( CustomerBranchAccountTypes )中没有要在INSERT语句中引用的PK值( 1"40-20-23" ,相应地为"Current" )。

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 这是SQLFiddle演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM