In MySQL this is supported if the storage engine is InnoDB. Other storage engines like MyISAM do not enforce the constraint (although MySQL allows the "references" syntax, but it has no effect: http://dev.mysql.com/doc/refman/5.7/en/example-foreign-keys.html ).
Check the storage engine for, e.g., the c1 table:
SHOW CREATE TABLE c1
Check which storage engine is used by default:
SHOW VARIABLES LIKE 'storage_engine'
Check that the foreign key checks are actually enforced:
SHOW VARIABLES LIKE 'foreign_key_checks'
If the storage engine is not InnoDB, you can convert your MyISAM tables to InnoDB, or (since this is a toy example) you can just recreate the tables. If you recreate the tables, you can either specify the storage engine at the end of your CREATE TABLE command, or you can set it before creating the tables, e.g.
SET storage_engine=MYISAM;
Similarly, if the foreign_key_checks variable is off, you can switch it on in this way:
SET foreign_key_checks=1;