Hi! I just found this site and am loving it so i'm gonna post my first question.. Hope somebody helps..
I'm using PHP and MySQL.. But That doesn't matter in my DB design..
I'm trying to do the following..
I have several tables in my DB.. Which I want to relate in undefined size groups which I will call PROPERTIES
Example:
TABLES
cars
houses
lots
boats
In each table, there's specific info of each kind..
I want to relate everything in a groups of properties of one guy.. But each guy may have several cars or none; the same with others..
So I thought of this..
Create a Table called PROPERTIES which has these fields..
PROP_id | guy | status
And another table called ELEMENTS
ELEM_id | PROP_id | element | type | description
So then I can add an undefined number of elements to a group..
So if I wan to add a car registered in
CARS table with id 35 to a group of
PROPERTIES with id 5; I write in ELEMENTS these values..
ELEM_id | PROP_id | element_id | type | description
1 | 5 | 35 | cars | blah blah blah
So that I can get the
element_id in the
type table (CARS) corresponding to the
element...
Is this and efficiente way to do it? Would Anyone use another more direct solution??
I'm worried about the
element_id and
type fields.. I don't feel it's a "clean" way to relate a field to a specified table..
P.S. Hope someone reads this.. XD