Re: Decline of Science: Computer Science and Databases
Date: Mon, 04 Nov 2002 14:58:38 +0200
Message-ID: <3DC66EFE.F4CF33B3_at_atbusiness.com>
Carl Rosenberger wrote:
> Lauri Pietarinen wrote:
> > > SELECT FROM Consultant, Coach WHERE .salary > 200000;
> >
> > Is'nt it rather a union than a join?
>
> Yes, sorry.
OK, how would you make a query that retrieves data from several tables (or objects) at once.
How would you formulate the following SQL-queries:
Using these tables...
customer(customer_id, customer_name)
order(order_id, customer_id, product_id, order_quantity)
product(product_id, product_name, product_price)
...get customer summary by product
select c.customer_name,
product_name, sum(order_quantity) as total_quantity, sum(order_quantity*product_price) as total_price from customer c, order o, product p where c.customer_id = o.customer_id and o.product_id = p.product_id group by c.customer_name, p.product_name order by customer_name, total_price desc;
... and product summary...
select product_name
sum(order_quantity*product_price) as total_sales from product p,
order o
where p.product_id = o.product_id
order by total_sales desc;
> > As a general remark I would say that the relational approach
> > requires more planning in the sense that you have to design and
> > create a database schema (=data modelling). However,
> > the reward is that
> > - extremely complex queries can be formulated
> > - arbitrary integrity constraints can be enforced
> > ( referential integrity being only the simplest case)
> > - queries can be optimised by an optimizer
>
> Why would any of the above not be possible with an object
> oriented approach?
How do you express integrity constraints? Say "every order must belong to a customer and have a valid product"
> One of the best languages we have developed is our human
> language. It sure is not pure relational math.
>
> I would rather say it is object oriented:
>
> You build up a temporary context of small "objects" and
> refer to them in subsequent "methods". The "object" context
> is temporary and get's overridden by subsequent "objects"
> that overload meanings.
Funny thing though that modern mathematics is 100% based on the notion of sets and relations. I think computer systems have more to do with mathematics than with natural language.
Regards,
Lauri Received on Mon Nov 04 2002 - 13:58:38 CET