I have a table called:
solicicaoemprestimo codemprestimo, dataemprestimo, horaemprestimo
And another table called:
loaned, codempresented, dateprice, timeprice, fk (requestpayment_codemprestimo)
and I used this command:
INSERT INTO emprestados (dataemprestimo,horaemprestimo, solicitacaoemprestimo_codemprestimo);
SELECT data emprestimo, horaemprestimo, codemprestimo FROM solicitacaoemprestimo WHERE codemprestimo = '13'
DELETE FROM solicitacaoemprestimo WHERE codemprestimo = '13';
error giving:
Error Code: 1451. Can not delete or update a parent row: a foreign key constraint fails (
trabalhoclubedodvd
.emprestados
, CONSTRAINTfk_emprestados_solicitacaoemprestimo1
FOREIGN KEY (solicitacaoemprestimo_codemprestimo
)
Only, at the time that I'm going to delete the table on my application because my DVD was rented, it does not leave, but I'd like to delete it because this item will no longer be used because the DVD was already rented ... If someone can help me right away I appreciate it ...