similar to ON DELETE CASCADE, not working in MySQL , but something is wrong:
ANSI path
use this all the time in postgres, but for some reason cannot get it in mysql.
I am slowly involved, there is ansi-standard, postgreql, and there is a mysql way. Every time I think I appreciated the difference somewhat, I did not come close.
MySQL path
CREATE TABLE `t2` ( `id` BIGINT(20) UNSIGNED NOT NULL, `data2` TEXT, PRIMARY KEY (`id`), CONSTRAINT `FK_t2_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = latin1;
For me, the code I have is ansi standard, makes perfect sense and (as far as SQL is concerned) is aesthetically pleasing, while the mysql-way (thanks for the help!) Reminds me of Visual Basic or something else - it's really ugly as a sin, and itβs not good to ask intelligent people to humiliate themselves in order to write such a thing.
I apologize if I ranted, and rightly deserved any number of negative ratings. You guys who easily write this code really respect me. I just don't want to see this kind of meaningless punishment on friends; -)
source share