Re: Leech (?) content of mySQL tables
From: badr (DWEBD_at_msn.com)
Date: 12/20/04
- Next message: Pedro Graca: "Re: Multi Table Query Help"
- Previous message: Pedro Graca: "Re: post variables always undefined"
- In reply to: knoak: "Leech (?) content of mySQL tables"
- Next in thread: Michael Fesser: "Re: Leech (?) content of mySQL tables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Dec 2004 03:27:10 -0800
hi , knoak
if i undrestand your quz , you are talking about the referential
integrity , that mean you want change , delete or add data to some
filed and it take effect to some other joind table , if so , in MySQL
the foregin key AND referential integrity are not supported in all type
of tables, like MyISAM, or HEAP , but in INNODB type yes they are.
so when you create your won tables you have to implement the
referential integrity by specifying your foreign key and table type.
for example if you have sections and employees and each employee have
difrenet permission to do some job we can make this :
Create table employee ("
emp_id varchar(15) PRIMARY KEY,
login_name varchar(25) not null unique,
login_pass varchar(15) not null,
empname varchar(20) not null,
index (emp_id)") TYPE=INNODB #####check the type (INNODB)
create table permission ("
emp_id Varchar(15) not null,
object_id int not null,
object_name varchar(40) not null,
index (emp_id),
index (object_id),
primary key (emp_id,object_id),
foreign key (emp_id)
references employee (emp_id) on delete cascade on update cascade") ##
here the
TYPE=INNODB #here also the type is INNODB
in this case if you delete employee from employee table its permission
will be deleted also , the same thing for updating. so it will be
cascaded in both operation
chek the versions of MySQL they may make it supported in some versions
http://www.mysql.com/search/?q=referential+integrity+&charset=iso-8859-1
for more information about referential integrity
http://www.databasejournal.com/features/mysql/article.php/2248101
- Next message: Pedro Graca: "Re: Multi Table Query Help"
- Previous message: Pedro Graca: "Re: post variables always undefined"
- In reply to: knoak: "Leech (?) content of mySQL tables"
- Next in thread: Michael Fesser: "Re: Leech (?) content of mySQL tables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|