Re: a problem about database modeling

From: Neo <neo55592_at_hotmail.com>
Date: 20 Jul 2006 20:46:26 -0700
Message-ID: <1153453586.436595.206610_at_75g2000cwc.googlegroups.com>


What exactly are your needs? Are you trying to avoid NULLs and or redundant data or more than X number of tables?
>
> the model is simple i hava device and every device has there own attributes and also the device type should be one of device's attibute.but the point is every type has there own attributes. so i do't know how to modeling this. i need avoid NULLs and redundant both. thanks for any help!

To model highly varied data without NULLs and redundancy in RMDB requires either generic modelling or lots of tables with lots of joins. Neither is simple. Below starting schema assumes a device can have 0 to many types. A dev/type can have 0 to many attributes. An attribute can have 0 to many values.

T_Dev (DevID, ...);
T_DType (DTypeID, ...);
T_DevDType (DevID, DTypeID, ...);
T_Attrib (AttribID, ....);
T_DTypeAttrib (DTypeAttribID, DTypeID, AttribID, ...);
T_Value (ValueID, ...);
T_DTypeAttribValue ([id], DTypeAttribID, ValueID, ...);
T_DevAttrib (DevAttribID, DevID, AttribID, ...);
T_DevAttribValue ([id], DevAttribID, ValueID, ...);

(With dbd, it takes care of the equivalent automatically, user simply enters data in the form of SVO sentences) Received on Fri Jul 21 2006 - 05:46:26 CEST

Original text of this message