Home » Developer & Programmer » Forms » database design
database design [message #82605] Thu, 12 June 2003 06:18 Go to next message
S
Messages: 27
Registered: December 2001
Junior Member
How to represent tree like hierarchy in a database table?
Re: database design [message #82651 is a reply to message #82605] Wed, 18 June 2003 03:05 Go to previous message
brigitte
Messages: 3
Registered: June 2003
Junior Member
You can do this with a self referencing table

create table_tree_table
(tree_table_id number(10),
description varchar2(100),
tree_table_id_ref number(10));
/* create primary key */
ALTER TABLE table_tree_table
ADD (CONSTRAINT TTT_PK PRIMARY KEY
(tree_table_id));
/* create foreign key */
ALTER TABLE table_tree_table ADD (CONSTRAINT
TTT_TTT_FK FOREIGN KEY
(tree_table_id_ref ) REFERENCES table_tree_table
(tree_table_id));

You can query this table with the connect by ... prior option
Previous Topic: read image file causing form to quit
Next Topic: Locking problem
Goto Forum:
  


Current Time: Thu Mar 28 18:54:27 CDT 2024