I'm having trouble creating a foreign key of these tables:
Code:
ALTER TABLE 'tb_permissao_view' ADD CONSTRAINT
'fk_tb_permissao_view_tb_sistema_pagina'
FOREIGN KEY ('cd_pagina')
REFERENCES 'tb_sistema_pagina' ('cd_pagina');
Error:
ALTER TABLE 'tb_permissao_view' ADD CONSTRAINT
'fk_tb_permissao_view_tb_sistema_pagina' FOREIGN KEY ('cd_pagina')
REFERENCES 'tb_sistema_pagina' ('cd_pagina')
Error Code: 1452. Cannot add or update a child row:
a foreign key constraint fails ('portal'.'#sql-4ee_f', CONSTRAINT
'fk_tb_permissao_view_tb_sistema_pagina' FOREIGN KEY ('cd_pagina') REFERENCES
'tb_sistema_pagina' ('cd_pagina'))