Bluehost.com Web Hosting $6.95

New table making reference to existing

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-30-2007
Erick Tedeschi
 
Posts: n/a
Default New table making reference to existing

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0