Muhammed,

----- Original Message -----
From: "Muhammed Syyid" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.mysql
Sent: Thursday, January 16, 2003 3:06 PM
Subject: Re: InnoDB Foreign Key Questions


> Second the same question :). What does the CONSTRAINT keyword
> regarding FOREIGN KEYS do?

the constraint name is simply ignored.

> Karam Chand, as far as I know, the drop command hasn't been
> implemented yet. So the only way to drop a foreign key is to drop and
> re-create the table.

DROP FOREIGN KEY will come in some 4.1.x version. Since the constraint name
is not stored, and is not required by the FOREIGN KEY syntax, I think that
the syntax could be

ALTER TABLE frobboz DROP FOREIGN KEY (column1) REFERENCES abbaguu (column2);

> Muhammed

Best regards,

Heikki Tuuri
Innobase Oy
---
Order technical MySQL/InnoDB support at https://order.mysql.com/
See http://www.innodb.com for the online manual and latest news on InnoDB

sql query


> [EMAIL PROTECTED] (Karam Chand) wrote in message
news:<avva22$168e$[EMAIL PROTECTED]>...
> > 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



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