I have homework that use TRIGGER Syntax with this code below
CREATE TABLE mahasiswa_log (
idLog INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
nim INT,
keterangan VARCHAR(30),
waktu TIMESTAMP
)ENGINE = INNODB;
DELIMITER //
CREATE TRIGGER insert_log
AFTER INSERT ON mahasiswa
FOR EACH ROW
BEGIN
INSERT INTO mahasiswa_log VALUES
(new.nim, 'Ditambah', NOW());
END //
DELIMITER ;
and after that, I tried to use that trigger in my code by making this code
INSERT INTO mahasiswa(nim, namaMahasiswa, idProdi, jenisKelamin, angkatan, asal) VALUES
(160613,'Sieg', 8, 'Laki-laki', 2016, 'Manado');
But that INSERT INTO
syntax wont work and it mentions that I have Error Code 1136 : Column count doesn't match value count at row 1.
After I tried to delete the TRIGGER Syntax using
DROP TRIGGER insert_log
, the INSERT INTO
Syntax can work properly, but I still wonder why the INSERT INTO Syntax wont work if the TRIGGER Syntax still exist
Already tried many ways and searching but still didn't know why my code has Error Code 1136 that mentions Column count doesn't match value count at row 1