B DEFAULT CHARSET=latin1
>
>
> CREATE TABLE `cfg_cluster_info` (
> `cluster` varbinary(128) NOT NULL,
> `admin` varbinary(128) NOT NULL,
> PRIMARY KEY (`cluster`),
> CONSTRAINT `cfg_cluster_info_ibfk_1` FOREIGN KEY (`cluster`) REFERENCES
> `cfg_tags` (`cluster`) ON DELETE
) NOT NULL,
`admin` varbinary(128) NOT NULL,
PRIMARY KEY (`cluster`),
CONSTRAINT `cfg_cluster_info_ibfk_1` FOREIGN KEY (`cluster`) REFERENCES
`cfg_tags` (`cluster`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
mysql> select * from cfg_tags;
+---+--++
| clus
reate table orders(OID int,
O_Date date,
customer_SID int,
primary key (OID),
Foreign key (customer_SID)
references customer (SID)
on delete cascade
To: mysql@lists.mysql.com
Subject: reg: on delete cascade
I created two tables like this:
create table customer(SID int,name varchar(20),primary key(SID));
create table orders(OID int,O_Date date,customer_SID int,primary
key(OID),Foreign key(customer_SID) references customer(SID) on delete
cascade
er_SID) references customer(SID) on delete
> cascade on update cascade);
>
> And inserted values into it.but when i deleted a row from customer which has
> reference in orders it didn't showed any error..it deleted the value in
> customer table while it's reference i
I created two tables like this:
create table customer(SID int,name varchar(20),primary key(SID));
create table orders(OID int,O_Date date,customer_SID int,primary
key(OID),Foreign key(customer_SID) references customer(SID) on delete
cascade on update cascade);
And inserted values into it.but when
ble.
--
Rhino
- Original Message -
From: "James Sherwood" <[EMAIL PROTECTED]>
To: "mysqllist"
Sent: Monday, July 17, 2006 8:44 AM
Subject: ON DELETE CASCADE question
Hello.
I have a question about on delete cascade.
If i have 2 tables such as this:
Tab
Hello.
I have a question about on delete cascade.
If i have 2 tables such as this:
Table1Table2
PrikeyPrikey
Table2foreinkey name
name description
description
Now if I delete a row from table1 that has a foreign
Victoria Reznichenko wrote:
Andrew DeFaria <[EMAIL PROTECTED]> wrote:
Victoria Reznichenko wrote:
Andrew DeFaria <[EMAIL PROTECTED]> wrote:
As you can see I when I delete from user (the parent table) the
useropts (child table) entry remains. Shouldn't it be deleted?
Heikki Tuuri asked me to loo
Andrew DeFaria <[EMAIL PROTECTED]> wrote:
> Victoria Reznichenko wrote:
>
>> Andrew DeFaria <[EMAIL PROTECTED]> wrote:
>>> As you can see I when I delete from user (the parent table) the
>>> useropts (child table) entry remains. Shouldn't it be deleted?
>>>
>>> Heikki Tuuri asked me to look at my
Victoria Reznichenko wrote:
Andrew DeFaria <[EMAIL PROTECTED]> wrote:
I created the following .sql file to demonstrate a problem I'm
having. According to the manual:
If |ON DELETE CASCADE| is specified, and a row in the parent table
is deleted, then InnoDB automatically d
Andrew DeFaria <[EMAIL PROTECTED]> wrote:
> I created the following .sql file to demonstrate a problem I'm having.
> According to the manual:
>
> If |ON DELETE CASCADE| is specified, and a row in the parent table
>is deleted, then InnoDB automatically dele
I created the following
.sql file to demonstrate a problem I'm having.
According to the manual:
If ON DELETE CASCADE is
specified, and a row in the parent table is deleted, then InnoDB
automatically deletes also all those rows in the child table
whose foreign key values are equal t
ts (
-> useridvarchar (8)not null,
-> nametinytext,
-> valuevarchar (128),
-> key user_index (userid),
-> foreign key (userid) references user (userid) on delete cascade
-> ) type=innodb; -- useropts
Query OK, 0 rows affe
---+-----+-++
> 3 rows in set (0.00 sec)
>
>
> mysql>alter table name add foreign key(id) references gene(id) on delete cascade;
>
> mysql> select * from gene;
> ++--+--
we're using a slightly different syntax. add the word "constraint" in
front of foreign key.
alter table name add constraint foreign key(id) references gene(id) on
delete cascade;
we rely on cascading deletes. This works in our case.
good luck.
"R.Dobson" wrote:
>
mmm, i've just tried the example within the mysql docs:
CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE cascade
) TYPE=I
char(100) | | | ||
+-+---+--+-+-++
3 rows in set (0.00 sec)
mysql>alter table name add foreign key(id) references gene(id) on delete cascade;
mysql> select * from gene;
++--+-+
| id | name | species |
++--+-+
| 9
hild(id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE cascade
) TYPE=INNODB;
Now, insert a couple of lies of data:
mysql> insert into parent values(1);
Query OK, 1 row affected (0.00 sec)
mysql> insert into p
"R.Dobson" <[EMAIL PROTECTED]> wrote:
>
> Hi, i'm using Distrib 4.0.1-alpha, for sun-solaris2.8 (sparc)
It's an outdated version and it doesn't support ON DELETE, just parsed. Upgraid MySQL
to the recent version (4.0.14)
--
For technical support contracts, goto https://order.mysql.com/?ref=e
type = InnoDB;
alter table Child add index(parent_id);
alter table Child add constraint foreign key(parent_id) references
Parent(id) on delete cascade;
mysql> insert into Parent values(1);
Query OK, 1 row affected (0.04 sec)
mysql> insert into Parent values(2);
Query OK, 1 row affecte
||
| species | varchar(100) | | | ||
+-+---+--+-+-++
3 rows in set (0.00 sec)
mysql>alter table name add foreign key(id) references gene(id) on delete cascade;
mysql> select * from gene;
++--+-+
|
KEY (parent_id) REFERENCES parent(id)
> ON DELETE cascade
> ) TYPE=INNODB;
>
> Now, insert a couple of lies of data:
>
> mysql> insert into parent values(1);
> Query OK, 1 row affected (0.00 sec)
>
> mysql> insert into parent values(2);
> Que
ey(gene_id) references gene(id) on delete
cascade;"
In fact, I'm not sure you can actually create the constraint as you
currently describe it
"R.Dobson" wrote:
>
> Hi, yes, I should have included in the first mail. They are:
>
AIL PROTECTED]>
Newsgroups: mailing.database.mysql
Sent: Wednesday, June 11, 2003 9:03 AM
Subject: ON DELETE CASCADE ON UPDATE CASCADE
> HI I'm not sure whether it's a bug or my configuration problem??
>
> I have upgraded mysql from 3.23.53 to 4.0.12 so that the on update
> c
> CREATE TABLE software_machineOSs (
-> softwareID CHAR(20) NOT NULL,
-> osName CHAR(20) NOT NULL,
-> osRevision CHAR(20),
-> INDEX (softwareID),
-> FOREIGN KEY (softwareID) REFERENCES software (softwareID)
ON DELETE CASCADE ON U
) unsigned NOT NULL default '0',
`Lft` smallint(5) unsigned NOT NULL default '0',
`Rgt` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`ShopId`),
KEY `Node` (`Node`),
CONSTRAINT `0_2042` FOREIGN KEY (`Node`) REFERENCES `Shops` (`ShopId`)
ON DELETE
On Thursday 12 December 2002 01:45, Jing Dai wrote:
> I tried on delete cascade, it didn't work either.
First of all , if you create table as you described in your previous mail,
foreign key will not be created. You can check it with SHOW TABLE STATUS.
Why? Because you
I tried on delete cascade, it didn't work either.
mysql> delete from samDB.license_info where licenseID=1;
Query OK, 1 row affected (0.01 sec)
mysql> select * from samDB.license_info;
Empty set (0.01 sec)
mysql> select * from samD
At 15:12 -0800 12/11/02, Jing Dai wrote:
After install mysql-max 3.23.52 and enable innodb setting in /etc/my.cnf
file, recreate table, this time
show create table indicated it's innodb type, but tried update on cascade
still not working.
ON DELETE CASCADE is implemented, but ON UPDATE CA
ERENCES samDB.license_info (licenseID) match full
on delete cascade on update cascade,
-> logDate DATE NOT NULL,
-> totalLic integer(5) NOT NULL,
-> requestLic integer(5) NOT NULL,
-> issuedLic integer(5) NOT NULL,
-> queuedLic integer(5) NOT NULL,
-> deniedLi
10 at 16:05:05 -0800, [EMAIL PROTECTED] wrote:
> > > I am just working on mySQL and create two tables, defined licenseID is
> > > the primary key in license_info, and foreign key in license_data.
> > > But I tested it didn't work the way as like in Ora
> I am just working on mySQL and create two tables, defined licenseID is
> > the primary key in license_info, and foreign key in license_data.
> > But I tested it didn't work the way as like in Oracle delete cascade or
> > update cascade.
> > Did I do something incorrec
Hello.
On Tue 2002-12-10 at 16:05:05 -0800, [EMAIL PROTECTED] wrote:
> I am just working on mySQL and create two tables, defined licenseID is
> the primary key in license_info, and foreign key in license_data.
> But I tested it didn't work the way as like in Oracle delete casca
I am just working on mySQL and create two tables, defined licenseID is
the primary key in license_info, and foreign key in license_data.
But I tested it didn't work the way as like in Oracle delete cascade or
update cascade.
Did I do something incorrect?
mysql> create table samDB.lice
gt; documentation says that foreign keys aren't implemented in MySQL, so how
m> to solve this elementary issue ?
Foreign keys are implemented in MySQL since 3.23.44b. ON DELETE
CASCADE are supported since 3.23.50. But if you want to use foreign
key constraints and ON CASCADE DELET
tivac" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 2:22 PM
Subject: How to On DELETE CASCADE
> Hello,
>
> I'm quite new in MySQL and PHP, so I guess my question is stupide. Sorry
> for that but I really need the
Hello,
I'm quite new in MySQL and PHP, so I guess my question is stupide. Sorry
for that but I really need the solution...
I have 2 tables
table Client :
---
|ClientID | ClientName|
---
|1| Eric |
|2| Mark |
|3| Simon
Pierre,
Tuesday, June 11, 2002, 4:51:16 PM, you wrote:
PB> does mysql-max 3.23.50 support the option on delete cascade for the
PB> foreign key, the documentation is not very clear on this point
Yes, since 3.23.50 MySQL supports ON DELETE CASCADE and ON DELETE SET
NULL on InnoDB table
[snip]
does mysql-max 3.23.50 support the option on delete cascade for the
foreign key, the documentation is not very clear on this point
[/snip]
No , it does not.
Jay
sql, mysql, query
-
Before posting, please check
does mysql-max 3.23.50 support the option on delete cascade for the
foreign key, the documentation is not very clear on this point
Pierre
--
sql,query
-
Before posting, please check:
http://www.mysql.com/manual.php
://www.beridney.com
- Original Message -
From: "Jeff Tanner" <[EMAIL PROTECTED]>
To: "Mysql (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, September 11, 2001 9:13 AM
Subject: FOREIGN KEY ... ON DELETE CASCADE
> Is FOREIGN KEY ... ON DELETE CASCADE operational in m
Is FOREIGN KEY ... ON DELETE CASCADE operational in mysql?
If so, I am not observing such. Here is how I am using it:
CREATE TABLE scheduled_task_list (
schedule_id CHAR(28) NOT NULL,
/* keys */
PRIMARY KEY (schedule_id)
);
CREATE TABLE
43 matches
Mail list logo