Re: why hierarchy?

From: Neo <neo55592_at_hotmail.com>
Date: 31 Jul 2006 12:07:30 -0700
Message-ID: <1154372849.998889.288100_at_75g2000cwc.googlegroups.com>


> Why not learn enough SQL to be able to identify a query that's a
> challenge in SQL, and *you* show how that query is easy in
> your thing.

Suppose we want to store persons, cars and who owns which cars. One way to do this in RMDB is to use the following schema:

T_Person (personID, name);
T_Car (carID, name);
T_Own (personID, carID);

T_Person
1 John
2 Mary

T_Car
1 Chevette
2 Corvette

T_Own

1(John), 1(Chevette)
2(Mary), 1(Chevette)
2(Mary), 2(Corvette)

// Find all cars owned by Mary
SELECT T_Car.*
FROM T_Person INNER JOIN (T_Car INNER JOIN T_Own ON T_Car.CarID = T_Own.CarID) ON T_Person.PersonID = T_Own.PersonID WHERE (((T_Person.Name)="mary"));

Below is dbd's equivalent:

(new 'john 'person)
(new 'mary 'person)
(new 'chevette 'car)
(new 'corvette 'car)
(new 'own 'verb)
(create john own chevette)
(create mary own chevette)
(create mary own corvette)
(select mary own *)

Would someone be willing to update the RMDB solution and compare it to dbd when meeting new data requirements. If you prefer you may start with a different schema/query. Received on Mon Jul 31 2006 - 21:07:30 CEST

Original text of this message