Re: What databases have taught me
Date: 25 Jun 2006 22:49:08 -0700
> > By the way, do any real-estate listings really track fridges?
> The andriod-based realtor that I am wiring in my garage, will :)
> > Most of your allegedly tough examples are based on physical modeling.
> If you mean't any modelling that that requires a table join or
> hierarchy, then there is some truth to that. In general, modelling
> hierarchies in RM cause some minor adjustments where as in dbd, it
> makes little difference if one is modelling a list, tree, table, or
> graph; they all require equally verbose scripts :) but the method
> remains largely unchanged.
> The tough part of dbd examples are the minimal impact to existing
> data/scripts/queries/code when meeting new data requirements unknown in
> advance (see example below).
> > > [Sample query to find first real-estate listing in dbd example 117]:
> > >
> > > (and (select single-family instance *)
> > > (select * has (and (select bedroom instance *)
> > > (select * has (and (select carpet instance *)
> > > (select * color purple)))))
> > > (select * has (and (select kitchen instance *)
> > > (select * has (and (select fridge instance *)
> > > (select * mfg sears))))))
> > [RMDB's query]:
> > SELECT * FROM houses
> > WHERE houseType="single family"
> > AND houseID in
> > (SELECT houseID FROM rooms WHERE carpetColor="purple")
> > AND houseID in (SELECT houseID FROM furniture
> > WHERE furnitureType="fridge" AND brand="Sears")
> > Note that I am assuming that the fridge can be anywhere in the house.
> > Adding kitchen-only would add another clause or join to the query.
> The above two queries are roughly equivalent (although the underlying
> data is structure is different, may need to add T_hasHierarchy). The
> most significant difference that is determinable from the queries is
> that in dbd's example, the fridge is located in the kitchen, where as
> in the RMDB example, the fridge is located in the house (which makes
> the RMDB query slightly simpler). Another signficant different that the
> fridge is a thing that could be move from one room to another or even
> one house to another without worrying about what
> attributes/subParts/contents belong to it.
> > People often put a 2nd fridge in their garage... I wonder how your query would look if the fridge could be in any room.
For the need it looks like you have in mind, perhaps it may make more sense to create a "meta" table(s) with dynamic attributes rather than a table for each kind of thing (furniture, rooms, etc). If a dynamic RDBMS existed in practice, such may not be necessary. But with the existing Oracle-copy-cat static-style RDBMS out there, skinny tables may be in order for your needs.
-T- Received on Mon Jun 26 2006 - 07:49:08 CEST