I have 2 tables.
CREATE TABLE `imovel` (
`id_imovel` int(11) NOT NULL,
`titulo` varchar(255) NOT NULL,
`tipo` varchar(100) NOT NULL,
`categoria` varchar(100) NOT NULL,
`dormitorios` int(11) NOT NULL,
`banheiros` int(11) NOT NULL,
`suites` int(11) NOT NULL,
`vaga_garagem` int(11) NOT NULL,
`endereco` varchar(255) NOT NULL,
`bairro` varchar(255) NOT NULL,
`valor` double NOT NULL,
`area_total` double NOT NULL,
`descricao` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `imagens` (
`id_imagem` int(11) NOT NULL,
`caminho` varchar(255) NOT NULL,
`tipo` varchar(50) NOT NULL,
`imovel_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
So I have relationships between them from 1 to n.
How do I delete the "imovel" with all the relationships he has.
Thank you for your help
what is the right way to do this?