Hello

I have two tables of InnoDB type.

CREATE TABLE `ledger` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) default NULL,
  PRIMARY KEY  (`id`),
  KEY `id` (`name`)
) TYPE=InnoDB;

CREATE TABLE `voucher` (
  `id` int(11) NOT NULL default '0',
  `vdate` date NOT NULL default '0000-00-00',
  `amount` decimal(10,0) default '100',
  `name` varchar(50) default 'Karam',
  PRIMARY KEY  (`id`,`vdate`)
) TYPE=InnoDB;

Now I add a Foreign Key reference to ledger.id for
voucher id by using the following command - 

alter table voucher
add constraint fk_key_1 foreign key (id) references
ledger (id)

now when i do a query - 

show table status like 'voucher'

I am getting the following value in the comment field.

InnoDB free: 23552 kB; (id) REFER rohit/ledger(id)

It shows that foreign key has been made but i had
specified it to be fk_key_1. Even if I make the
Foreign Key without the keyword constraint the same
thing happens ? 

So, what is the purpose of CONSTRAINT keyword. How can
I give a name to a relationship.

Also after reading the MySQL and InnoDB docs I am not
able to guess how to drop a FOREIGN KEY ? 

How can I do that ?

I am using mysql-mx-nt 3.23.54 running as a service in
WinXP.

Any help will be appreciated. Thanks in advance.

Karam

sql, query ( filteraide )


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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