This is a discussion on New table making reference to existing within the MySQL Database forums, part of the Database Forums category; I had a database like folow: CREATE TABLE `questions` ( `id` int(11) NOT NULL auto_increment, `tipo` tinyint(4) NOT NULL ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I had a database like folow:
CREATE TABLE `questions` ( `id` int(11) NOT NULL auto_increment, `tipo` tinyint(4) NOT NULL default '2', `enunciado` text NOT NULL, `created` timestamp NOT NULL default CURRENT_TIMESTAMP, `updated` timestamp NULL default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; CREATE TABLE `questions_itens` ( `id` int(11) NOT NULL auto_increment, `questions_id` int(11) NOT NULL, `txtoption` text NOT NULL, PRIMARY KEY (`id`), KEY `questions_id` (`questions_id`), CONSTRAINT `questions_itens_ibfk_1` FOREIGN KEY (`questions_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB and now, i need to make a new table "tests" that it makes reference to table "questions". When a row of table "tests" to make reference to table "questions", the questions table do not execute "delete". how I can make this? sorry my english |