MySQL Forums
Forum List  »  Newbie

Re: self relations... (what??!!!)
Posted by: info
Date: March 17, 2005 09:33AM

Thanx, i have read and enjoy your fast and interesting response.

I have a self-relation because i need to store elements that are made of another elements.
Example: Computer parts: Processor, memory dimms, motherboard, ethernet card, ...
id id_p name
1 1 PC
2 1 Box (the box of the pc)
3 2 Motherboard
4 2 3 1/2
5 2 Power supply
6 3 Processor
7 3 Memory
8 3 Ethernet card
...
...
I think this is the better way to store this.
The elements with id = id_p are root elements, that is, elements without parent.
I have used this schema with oracle and interbase without problems, and i'm surprised with this behaviour in mysql; it seems is a bug.

One way to do what I need is this:
1) I store the values (1,1) in the table. This values are system-dependent: Not visible, but necessary for the application to work.
2) Next values stored in the table need to have id_p = 1. I can delete this values without problems. The bad story of this is that i can't have root elements :|

Thanx

Options: ReplyQuote


Subject
Written By
Posted
March 16, 2005 10:48AM
Re: self relations... (what??!!!)
March 17, 2005 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.