# Error Code 1452 can't add or update child

**URL:** <https://forum.codewithmosh.com/t/error-code-1452-cant-add-or-update-child/7432>\
**Category:** Uncategorized\
**Created:** [September 20, 2021, 10:16am UTC](https://forum.codewithmosh.com/t/error-code-1452-cant-add-or-update-child/7432 "2021-09-20T10:16:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nerd\_World\_View](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Nerd\_World\_View](https://forum.codewithmosh.com/u/Nerd_World_View)\
**Post date:** [September 20, 2021, 10:16am UTC](https://forum.codewithmosh.com/t/error-code-1452-cant-add-or-update-child/7432/1 "2021-09-20T10:16:11Z")

</div>

Hello!

```
In the lesson 'Inserting Hierarchical Rows' I am having trouble following along with this exercise. I have entered the code the same way as on the screen but when I go to execute it gives me the Error Code 1452 cannot add or update a child row. I'm not sure what I am doing wrong in this instance. This is the code that I have entered:

```

INSERT INTO orders(  
customer\_id,  
order\_date,  
status)  
VALUES (  
1,  
‘2019-01-02’,  
1);

INSERT INTO order\_items  
VALUES  
(LAST\_INSERT\_ID(), 1, 1, 2.95),  
(LAST\_INSERT\_ID(), 2, 1, 3.95)

Any assistance in this would be greatly appreciated!
