Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem: Foreign key and Referential Integrity

Status
Not open for further replies.

ftsw

Technical User
Sep 17, 2002
9
0
0
US
I am having trouble with mysql accepting FOREIGN KEY REFERENCES and the referential integrity ON DELETE CASCADE and ON DELETE RESTRICT.Can you help? Thank You

CREATE TABLE user (
user_email varchar(50) NOT NULL,
nf_num int(6),
com_num int(6),
f_num int(6),
PRIMARY KEY (user_email)
FOREIGN KEY nf_num REFERENCES non_order),
ON DELETE CASCADE),
FOREIGN KEY com_num REFERENCES comment),
ON DELETE CASCADE),
FOREIGN KEY f_num REFERENCES order),
ON DELETE RESTRICT)
);
 
MySQL doesn't support referential integrity for its default table type. You will have to create a table of type "InnoDB" in order to use referential integrity.

Also, MySQL's implementation of foreign keys is not completely ANSI SQL compliant. I don't know if it supports ON DELETE RESTRICT.

Want an open source DBMS for PHP that supports full integrity constraints? ( -- see faq699-1751 ). -------------------------------------------

Big Brother: "War is Peace" -- Big Business: "Trust is Suspicion"
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top