You should not to quote your tablenames and fieldnames with apostroph
Use ` character.
delimiter //
CREATE TRIGGER addperson AFTER INSERT ON person
FOR EACH ROW
begin
IF NEW.persontype = 'donor' THEN
insert into `donor`(`personid`,`donor-id`)values(new.personid,new.personid);
ELSE
insert into `enterpreneur`(`personid`,`enter-id`) values(new.personid,new.personid);
END IF;
END;//
delimiter ;
My SQLFiddle not worked... :(
Here my home mysql:
$ mysql
mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> CREATE TABLE person (a varchar(25));
Query OK, 0 rows affected (0.47 sec)
mysql> CREATE TABLE donor (a varchar(25));
Query OK, 0 rows affected (0.05 sec)
mysql> CREATE TABLE enterpreneur (a varchar(25));
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> delimiter //
mysql> CREATE TRIGGER addperson AFTER INSERT ON person
-> FOR EACH ROW
-> begin
-> IF NEW.a = 'donor' THEN
-> insert into `donor`(`a`)values(new.a);
-> ELSE
-> insert into `enterpreneur`(`a`) values(new.a);
-> END IF;
-> END;//
Query OK, 0 rows affected (0.03 sec)
mysql> delimiter ;
mysql>
mysql>
mysql> INSERT INTO person VALUES ('donor'), ('not a donor');
Query OK, 2 rows affected (0.05 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> select * from donor;
+-------+
| a |
+-------+
| donor |
+-------+
1 row in set (0.00 sec)