If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > REFERENTIAL INTEGRITY & MYSQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-27-04, 02:30
divined divined is offline
Registered User
 
Join Date: Apr 2004
Posts: 110
REFERENTIAL INTEGRITY & MYSQL

Hello everybody


I need to know whether MySQL supports referential integrity under MyISAM tables. I want to create two tables with a one-to-many relation. The one side of the relation should not be deleted if there exists at least one record in the many side.

e.t.c.

CREATE TABLE SPARE_PART (
repair_id LONGINT UNSIGNED FOREIGN KEY REFERENCES REPAIR.repair_id,
other fields);

Syntax like that works under Oracle (not sure this is syntax-error free as I recalled it from memory, but the concept is the same). Can I write such SQL statements under MySQL using MyISAM tables?

thx, in advance

George Papadopoulos
Reply With Quote
  #2 (permalink)  
Old 05-27-04, 08:19
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
You need to use innodb tables for this.
Reply With Quote
  #3 (permalink)  
Old 05-31-04, 07:37
omiossec omiossec is offline
Registered User
 
Join Date: Jan 2003
Location: Paris, France
Posts: 320
Try to setup INNODB table space to use referential integrity

http://www.lasso-developpeur.net/us/...tab=db&lang=us
__________________
Olivier Miossec
--
http://www.lasso-developpeur.net/
--
Reply With Quote
  #4 (permalink)  
Old 06-07-04, 10:49
addo addo is offline
Registered User
 
Join Date: May 2004
Posts: 1
Hi,
In case that i have already build up the myISAM-type db, and inserted data in. I have searched that we can not convert mySIAM-type table to innoDB-type directly.

I want to ask whether there is a solution for this?
Can export insert script, delete existing db, create a fresh one, run the insert sql solve it?

Thanks
Reply With Quote
  #5 (permalink)  
Old 06-07-04, 12:07
snorp snorp is offline
Registered User
 
Join Date: Apr 2004
Location: Europe->Sweden->Stockholm
Posts: 71
Quote:
Originally Posted by addo
Hi,
In case that i have already build up the myISAM-type db, and inserted data in. I have searched that we can not convert mySIAM-type table to innoDB-type directly.

I want to ask whether there is a solution for this?
Can export insert script, delete existing db, create a fresh one, run the insert sql solve it?

Thanks
Either I don't understand this right, or the info you have read is seriously wrong. To me it seems that what you want to do is set up InnoDB and then

ALTER TABLE tab ENGINE=InnoDB;
Reply With Quote
  #6 (permalink)  
Old 06-08-04, 15:21
Leaden Leaden is offline
Registered User
 
Join Date: Dec 2003
Location: Houston, TX
Posts: 21
Quote:
Originally Posted by omiossec
Try to setup INNODB table space to use referential integrity

http://www.lasso-developpeur.net/us/...tab=db&lang=us
Your informaiton is out of date.

Quote:
InnoDB is included in binary distributions by default as of MySQL 4.0. For information about InnoDB support in MySQL 3.23, see section 16.3 InnoDB in MySQL 3.23.
http://dev.mysql.com/doc/mysql/en/InnoDB_overview.html
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On