Re: Multiple-Attribute Keys and 1NF

From: Neo <neo55592_at_hotmail.com>
Date: Thu, 30 Aug 2007 15:08:15 -0700
Message-ID: <1188511695.845062.209130_at_i38g2000prf.googlegroups.com>


> I'd like to suggest that we return to
> a classic contrived example for this newsgroup:
> the subject of pizzas and toppings.

Below dbd script models two orders with pizzas, the second with multiple cheeses and topping.

(new 'order)
(new 'pizza)
(new 'size)
(new 'crust)
(new 'cheese)
(new 'topping)
(new 'coke 'drink)

(; Create order#1 consisting of a small pizza)
(new 'order#1 'order)
(set (it) item (block (new)

(set pizza instance (it))
(set+ (it) size 'small)
(set+ (it) crust 'thin)
(set+ (it) cheese 'mozzarella)
(set+ (it) topping 'veggies)
(it)))
(; Create order#2 consisting of a large pizza and 4 drinks) (new 'order#2 'order) (set (it) item (block (new)
(set pizza instance (it))
(set+ (it) size 'large)
(set+ (it) crust 'thick)
(set+ (it) cheese 'mozzarella)
(set+ (it) cheese 'parmesan)
(set+ (it) topping 'sausage)
(set+ (it) topping 'pepperoni)
(set+ (it) topping 'olive)
(it)))
(set+ (it) item coke quantity '4) (; Get orders with small pizza)

(; Gets order#1)
(and (get order instance *)
     (get * item (and (get pizza instance *)

(get * size small))))
(; Get orders with pizza with mozzarella cheese)
(; Gets order#1 and order#2)
(and (get order instance *)
     (get * item (and (get pizza instance *)

(get * cheese mozzarella))))

For details, see www.dbfordummies.com/example/ex305.asp Received on Fri Aug 31 2007 - 00:08:15 CEST

Original text of this message