I would like to have a trigger to perform following operation for inserted records:
# pseudocode if new.group_id is null set new.group_id = new.id els
A trigger seems like overkill in this situation. Simply apply a default.
CREATE TABLE `test` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `value` varchar(100) NOT NULL, `group_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '2' )