Re: some howto/theory book/tutorial on practical problem solving in SQL - Mailing list pgsql-sql

From Ivan Sergio Borgonovo
Subject Re: some howto/theory book/tutorial on practical problem solving in SQL
Date
Msg-id 20090114120529.0ab11424@dawn.webthatworks.it
Whole thread Raw
In response to Re: some howto/theory book/tutorial on practical problem solving in SQL  (Erik Jones <ejones@engineyard.com>)
List pgsql-sql
On Tue, 13 Jan 2009 22:18:32 -0800
Erik Jones <ejones@engineyard.com> wrote:

> 
> On Jan 11, 2009, at 8:32 AM, Ivan Sergio Borgonovo wrote:
> 
> > I'm looking to some book/tutorial/sample code that will teach me
> > how to use SQL to solve some standard problem that goes a bit
> > beyond using group by and aggregates.
> >
> > Something like "SQL problem solving" or "SQL design strategies
> > for selected problems".

> O'Reilly's SQL Hacks is a good one that fits the bill you describe.

Thanks.

I think it is complementary to Celko's SQL puzzles.
O'Reilly's book seems techniques on the field.
Celko's book seems design on the field.

Elsevier seems to make it difficult to buy ebooks in a convenient
way.
I think I'm going to buy 'SQL hacks'. It still seems a good
investment.

Meanwhile I downloaded all the ecommerce, billing and ERP Open Source
programs I know (over 60) and started to examine the code to see
how they manage discounts in SQL.

The one that seems more promising to learn from seems:
ofbiz
webERP
promogest

You can find the most flexible discount management in the ecommerce
programs but they do it in the client language (php) rather than in
sql and most (all?) the time in a way that's not compatible with a
1M items catalog and that is not atomic when you close the order.

$result=db_query("select [some items from catalogue]");
while($row=db_fetch_array($result1) { //some logic $result2=db_query("select [some extra data about item]"); //compute
discount

The billing/ERP programs have a more B2B approach so it seems that
marketing is not among their priorities.
They end up in having stuff like
create table prices( itemid int references items (itemsid), discountclass int references discountclient (classid),
pricenumeric
 
)

But no way to mass apply/revoke overlapping discounts.

I'll come back asking comments on a possible design to solve my
problem later.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



pgsql-sql by date:

Previous
From: Erik Jones
Date:
Subject: Re: some howto/theory book/tutorial on practical problem solving in SQL
Next
From: Steve Midgley
Date:
Subject: Re: some howto/theory book/tutorial on practical problem solving in SQL