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
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
Ok, I found answer, I did need uncomment out my.cnf to support InnoDB type. Also I need
to install mysql-max binary as I am running on Unix Platform.
jing
Jing Dai wrote:
> Hi,
> Thank you for the reply.
> I did what you suggested, but show create table is still MYISM, why?
> Do I need to configu
Hi,
Thank you for the reply.
I did what you suggested, but show create table is still MYISM, why?
Do I need to configure something in the my.cfn file?
mysql> create table samDB.license_info (
-> licenseID integer(5) auto_increment primary key,
-> vendorName VARCHAR(30) NOT NULL,
-> fe
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 cascade or
> update casca
license_info
(licenseID) match full on delete cascade on update cascade,
-> logDate DATE NOT NULL,
-> totalLic integer(5) NOT NULL,
-> issuedLic integer(5) NOT NULL,
-> queuedLic integer(5) NOT NULL,
-> deniedLic integer(5) NOT NULL,
-> comment VARCHAR(1
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
38 matches
Mail list logo