mysql, query

Hi, all,

I have a development table which is created using the following commands on 3.23.53-log mysql server on MAC 10

CREATE TABLE web_transaction_item(
trans_item_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
trans_id INT UNSIGNED,
prod_id INT UNSIGNED,
INDEX xie_trans_id(trans_id),
FOREIGN KEY (trans_id) REFERENCES web_transaction(trans_id),
INDEX xie_web_prod_id(prod_id),
FOREIGN KEY (prod_id) REFERENCES test_product(prod_id)
) TYPE=INNODB;

After that, I executed
"ALTER TABLE web_transaction_item
ADD FOREIGN KEY(prod_id) REFERENCES test_product (prod_id) ON DELETE SET NULL;"

And I use show create table ...
mysql>show create table web_transaction_item;
| web_transaction_item | CREATE TABLE `web_transaction_item` (
`trans_item_id` int(10) unsigned NOT NULL auto_increment,
`trans_id` int(10) unsigned default NULL,
`prod_id` int(10) unsigned default NULL,
PRIMARY KEY (`trans_item_id`),
KEY `xie_trans_id` (`trans_id`),
KEY `xie_web_prod_id` (`prod_id`),
FOREIGN KEY (`prod_id`) REFERENCES `test.test_product` (`prod_id`),
FOREIGN KEY (`trans_id`) REFERENCES `test.web_transaction` (`trans_id`),
FOREIGN KEY (`prod_id`) REFERENCES `test.test_product` (`prod_id`) ON DELETE SET NULL
) TYPE=InnoDB |


Note that, there is two foreign keys reference prod_id. Is there some problem with the multiple references to the prod_id? or is this fine?

I think the second one "FOREIGN KEY (`prod_id`) REFERENCES `test.test_product` (`prod_id`) ON DELETE SET NULL" overide the first one "FOREIGN KEY (`prod_id`) REFERENCES `test.test_product` (`prod_id`)"

What's the syntax to drop the foreign key constaints?

Thank you and regards,
Jannie




_________________________________________________________________
The new MSN 8 is here: Try it free* for 2 months http://join.msn.com/?page=dept/dialup


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to