Re: some howto/theory book/tutorial on practical problem solving in SQL

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: some howto/theory book/tutorial on practical problem solving in SQL
Date: 2009-01-14 11:05:29
Message-ID: 20090114120529.0ab11424@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 13 Jan 2009 22:18:32 -0800
Erik Jones <ejones(at)engineyard(dot)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),
price numeric
)

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2009-01-14 18:51:49 Re: some howto/theory book/tutorial on practical problem solving in SQL
Previous Message Erik Jones 2009-01-14 06:18:32 Re: some howto/theory book/tutorial on practical problem solving in SQL