If I create a table like this:

CREATE TABLE depts (
  ID Int AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(30)
) TYPE=InnoDB;

I add three Records to this table.

THen I create this other table:

CREATE TABLE employees(
 ID INT AUTO_INCREMENT PRIMARY KEY,
 name varchar(20),
 dept_id INT,
 FOREIGN KEY (dept_id) REFERENCES depts(ID) ON DELETE RESTRICT
) TYPE=InnoDB;

Then I add 2 records to this table, one with value 1 on dept_id field and
the other with value 2.

I want:

If I attempt to delete Record with ID 1 on table depts, that MySQL don't
allows me to do so, or that it updates the records at table employees to
be deleted or updated to value 2 on the field dept_id.

i have InnoDB and BDB working on the System, but I don't know how to do
this, every time I delete from table depts, nothing happens at the records
at table employees, no warnings, no nothing.

Any Idea ?

I'm Using MySQL Max 4.0.1 on RedHat Linux

Regards

Yurais



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