I want import data from excel to db. I don't understand how to resolve this problem. I will be happy if you find out why this problem happens. Here is my SQL:
CREATE TABLE IF NOT EXISTS `berobat` (
`id_berobat` int(11) NOT NULL AUTO_INCREMENT,
`tgl_berobat` date NOT NULL,
`id_pasien` int(11) NOT NULL,
`id_puskesmas` int(11) NOT NULL,
`id_penyakit` int(11) NOT NULL,
PRIMARY KEY (`id_berobat`),
KEY `id_pasien` (`id_pasien`),
KEY `id_puskesmas` (`id_puskesmas`),
KEY `id_penyakit` (`id_penyakit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `berobat`
--
Mysql said :
#1452 - Cannot add or update a child row: a foreign key constraint fails (`dinkes`.`berobat`, CONSTRAINT `berobat_ibfk_1` FOREIGN KEY (`id_pasien`) REFERENCES `pasien` (`id_pasien`))