# Deleting a primary key with a foreign key attached

**URL:** <https://forum.kirupa.com/t/deleting-a-primary-key-with-a-foreign-key-attached/314448>\
**Category:** programming\
**Created:** [September 28, 2010, 10:56pm UTC](https://forum.kirupa.com/t/deleting-a-primary-key-with-a-foreign-key-attached/314448 "2010-09-28T22:56:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tic](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tic](https://forum.kirupa.com/u/tic)\
**Post date:** [September 28, 2010, 10:56pm UTC](https://forum.kirupa.com/t/deleting-a-primary-key-with-a-foreign-key-attached/314448/1 "2010-09-28T22:56:30Z")

</div>

Hi.

I have a question.  
If i do something like this

Delete from writers where id = ‘1’

I get errir #1451 - cannot delete or update a parent row: a foreign key constraint fails. (‘library’. ‘review’, CONSTRAINT ‘fk\_review\_book1’ FOREIGN KEY (‘bookID’) REFERENCES ‘book’ (‘ID’))

Now how would i go about do still get the same effect i want… Wich is removing the item with id 1 from my writers list, but also termination the connection with the other lists (preferably in 1 go)
