4
I have a table called:
soliciting codemprestimo, dataemprestimo, horaemprestimo
And another table called:
loan, co-loan, loan, loan, loan, loan, loan)
and 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';
mistake you’re making:
Error Code: 1451. Cannot 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 will delete in the table I request it because my dvd has been rented, it does not let, but I would like to delete because this item will no longer be used because the dvd has already been rented... If anyone can help me right away I’d appreciate it...
Provide more data , what kind of error occurs, structure of tables fks , fks , triggers etc.
– Motta
The column
solicitaremprestimo_codemprestimo
refersa coluna
co-employmentda tabela
soliciting`?– user25930
This error:Error Code: 1451. Cannot delete or update a Parent Row: a Foreign key Constraint fails (
trabalhoclubedodvd
.emprestados
, CONSTRAINTfk_emprestados_solicitacaoemprestimo1
FOREIGN KEY (solicitacaoemprestimo_codemprestimo
)– Carlos Leandro Ferreira de Alm
Yes make reference ...
– Carlos Leandro Ferreira de Alm
@Carlosleandroferreiradealm managed to solve this question?
– Marconi