| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Nulls, integrity, the closed world assumption and events
> 8. Data for Every 1
> http://www.tincat-group.com/mewsings/2006/03/data-for-every-1.html
> Specific example of an SQL query compared to an MV query.
Below I add iddy biddy dbd's query and view for comparison:
MV Query:
LIST PIZZAS WITH EVERY TOPPING <> "PEPPERS"
RMDB Query
SELECT P1.PIZZA_ID FROM PIZZA AS P1 WHERE P1.PIZZA_ID NOT IN (SELECT
P2.PIZZA_ID FROM PIZZA_TOPPING AS P2 WHERE TOPPING = "PEPPERS")
dbd query:
(& (get pizza instance *)
(get * topping (!= (get topping instance *)
peppers)))
MV view of pizza:
PizzaID Crust Cheeses Toppings
12345 Chicago Mozzarella Peppers
Provolone Mushrooms
Pepperoni
RMDB view of pizza:
PizzaID Crust Cheeses Toppings
12345 Chicago Mozzarella Peppers
12345 Chicago Mozzarella Mushrooms
12345 Chicago Mozzarella Pepperoni
12345 Chicago Provolone Peppers
12345 Chicago Provolone Mushrooms
12345 Chicago Provolone Pepperoni
dbd's tree view of pizza:
pizza
id
12345
crust
chicago
cheese
mozzarella
provolone
topping
peppers
mushrooms
pepperoni
Pizzas taste better when they grow on tall trees! Received on Mon Jan 22 2007 - 17:58:46 CST
![]() |
![]() |