[Ilugc] Help in MySQL

  • From: binand@xxxxxxxxx (Binand Sethumadhavan)
  • Date: Fri Aug 12 12:44:31 2005

On 11/08/05, Aravindakshan M R <digivind@xxxxxxxxxxxxxx> wrote:

Can anybody pls tell, how do i connect 2 tables with foreign key using common
fields.....
If i delete one row on table 1 then it should automatically cascaded with a
deletion of the corresponding row in table 2.....
pls tell a solution soon

Which version of MySQL? Until 5.x somewhere, MySQL didn't support
foreign keys (and it called itself a SQL database ;)

The syntax would be:

create table mytable (
    somefield int4,
    constraint somefield_valid foreign key (somefield) references
someothertable(itsfield) on delete cascade
);

Binand

Other related posts: