Hi all,
I am rather new to database design and modelling concepts in general
and was hoping for some advice on a problem I am trying to solve. I
have designed a piece of software that creates a tree with pluggable
nodes. Each node class can have 0 to n distinct classes plugged into
it to define the type for that node.
For example, a node plugged with a 'customer' class and an 'engineer'
class would indicate that this node in the tree is an engineer who is
also a customer. We could also have a 'owner', 'engineer' etc.
I now want to persist this tree in an SQL Server 2000 Database. I have
chosen to implement the nested set model, and have thought about the
following table design:
table NODE_TABLE:
lft INTEGER
rft INTEGER
propsID INTEGER
table PROPERTIES_TABL E:
propsID INTEGER
tableName VARCHAR
table CUSTOMER_TABLE:
propsID INTEGER
firstname CHAR
lastname CHAR
table ENGINEER_TABLE:
propsID INTEGER
num_completed_p rojects INTEGER
degree CHAR
school CHAR
table OWNER_TABLE:
propsID INTEGER
companyName CHAR
So, given the above example - I would have a NODE_TABLE that links to 2
entries in PROPERTIES_TABL E. One entry would link to an entry in the
CUSTOMER_TABLE, the other to an entry in ENGINEER_TABLE.
Are there any more efficient solutions to this problem? As i said, I
am very new to DB design and would welcome any feedback or suggestions
of how else I might model my pluggable tree in a Database. Thank you,
Bob Yohan
I am rather new to database design and modelling concepts in general
and was hoping for some advice on a problem I am trying to solve. I
have designed a piece of software that creates a tree with pluggable
nodes. Each node class can have 0 to n distinct classes plugged into
it to define the type for that node.
For example, a node plugged with a 'customer' class and an 'engineer'
class would indicate that this node in the tree is an engineer who is
also a customer. We could also have a 'owner', 'engineer' etc.
I now want to persist this tree in an SQL Server 2000 Database. I have
chosen to implement the nested set model, and have thought about the
following table design:
table NODE_TABLE:
lft INTEGER
rft INTEGER
propsID INTEGER
table PROPERTIES_TABL E:
propsID INTEGER
tableName VARCHAR
table CUSTOMER_TABLE:
propsID INTEGER
firstname CHAR
lastname CHAR
table ENGINEER_TABLE:
propsID INTEGER
num_completed_p rojects INTEGER
degree CHAR
school CHAR
table OWNER_TABLE:
propsID INTEGER
companyName CHAR
So, given the above example - I would have a NODE_TABLE that links to 2
entries in PROPERTIES_TABL E. One entry would link to an entry in the
CUSTOMER_TABLE, the other to an entry in ENGINEER_TABLE.
Are there any more efficient solutions to this problem? As i said, I
am very new to DB design and would welcome any feedback or suggestions
of how else I might model my pluggable tree in a Database. Thank you,
Bob Yohan
Comment