Home > database >  Rookie question, SQL will know will be the sample import problems
Rookie question, SQL will know will be the sample import problems

Time:10-01

Good bosses, I 0 based learning SQL, bought a SQL will be will be, the import of the book with the MySQL example, a total of two TXT, the first is "create" can copy and paste and perform the success, the second TXT "populate" copy and paste into executed after failure, next is how to return a responsibility excuse me, thank you very much
Error: "09:09:11 INSERT INTO OrderItems (order_num, order_item prod_id, quantity, item_price) VALUES (20009, 3, 'BNBG03', 250, 2.49) the Error Code: 1452. Always add or update a child row: a foreign key constraint fails (` test `. ` OrderItems `, constraint ` FK_OrderItems_Orders ` foreign key (` order_num `) REFERENCES ` orders ` (` order_num `)) 0.031 SEC
"

CodePudding user response:

The create table with foreign key
The role of the foreign key is inserted into the data of a column must be the value of another table

CodePudding user response:

reference 1st floor rucypli response:
create table has a foreign key
The role of the foreign key is inserted into the data of a column must be another table values


Well, it seems that the sample has a problem, I in the http://blog.csdn.net/zoroday/article/details/54809042 new example of an SQL formats can be imported to normal use, thank you for your moderator reply
  • Related