Re: [SQL] some howto/theory book/tutorial on practical problem solving in SQL
On Tue, 13 Jan 2009 22:18:32 -0800 Erik Jones 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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Re: some howto/theory book/tutorial on practical problem solving in SQL
At 09:20 AM 1/14/2009, pgsql-sql-ow...@postgresql.org wrote: Date: Wed, 14 Jan 2009 12:05:29 +0100 From: Ivan Sergio Borgonovo To: pgsql-sql@postgresql.org Subject: Re: some howto/theory book/tutorial on practical problem solving in SQL Message-ID: <20090114120529.0ab11...@dawn.webthatworks.it> In-Reply-To: <375b6e92-443f-4bd3-bd03-908925639...@engineyard.com> References: <2009073227.159ab...@dawn.webthatworks.it> <375b6e92-443f-4bd3-bd03-908925639...@engineyard.com> > O'Reilly's SQL Hacks is a good one that fits the bill you describe. 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. 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 I'll come back asking comments on a possible design to solve my problem later. Hi Ivan, You're studying something very interesting, and I hope you will post your progress and solutions, questions and ideas back to this list as you go. I've forwarded this thread already to several people who work with related issues, and they're very interested in some solutions as well. So stay in touch as you work on this, please. Sincerely, Steve -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql