Re: COUNT(*) to find records which have a certain number of

From: Chester Kustarz <chester(at)arbor(dot)net>
To: T E Schmitz <mailreg(at)numerixtechnology(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: COUNT(*) to find records which have a certain number of
Date: 2004-09-20 20:55:38
Message-ID: Pine.BSO.4.44.0409201648350.17616-100000@detroit.arbor.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches pgsql-sql

On Mon, 20 Sep 2004, T E Schmitz wrote:
> I was feeling a bit guilty about posting such a trivial question. I can
> cobble together some straightforward SQL but I could really do with a
> source of more complex SQL examples.
> If you know of any links - that would great and save the list from more
> such questions ;-)

SQL for Smarties has some more complicated examples and topics for
"advanced" type queries. I can't say it's exhaustive, but I found it
a good bridge by hinting at what is really possible. I also found that
a good way to improve is to try to write every complicated query by
using all the different ways I can think of, like:

- UNION (ALL)
- SUB-SELECT
- LEFT OUTER JOINS
- HAVING
etc.

Here is the link for SQL for Smarties:

http://www.amazon.com/exec/obidos/tg/detail/-/1558605762/002-2222957-7220055?v=glance

The bad thing about the book is that it is sort of SQL agnostic, so
some of the examples would be sub-optimal on postgresql, or may not
even work.

I would like to hear about other sources too.

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Devrim GUNDUZ 2004-09-20 21:38:17 Re: Turkish translation of initdb.pot
Previous Message Greg Stark 2004-09-20 20:45:48 Re: COUNT(*) to find records which have a certain number of dependencies ?

Browse pgsql-sql by date

  From Date Subject
Next Message Ramiro Batista da Luz 2004-09-20 21:30:24 unsubscribe
Previous Message Stephan Szabo 2004-09-20 20:51:09 Re: Help with function