simple sql select help

From: kaf(at)ip146(dot)usw5(dot)rb1(dot)bel(dot)nwlink(dot)com (Kyle)
To: pgsql-sql(at)postgresql(dot)org
Subject: simple sql select help
Date: 1999-12-17 18:03:56
Message-ID: 83dtuc$1nh$1@ip146.usw5.rb1.bel.nwlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I'm fairly new to sql & postgres. I need some help with this query on
a database I'm constructing. I've got two tables, publishers & books,
which have the following columns (some columns removed for simplicity):

publishers:
name (primary key), address, ...

books:
title, publisher, ...

Given the above I'd like to query the database to see how many books
each publisher has.

The publisher column of the books table should be declared a foreign
key to publishers.name, though I haven't put the appropriate triggers
in yet. Like I said, I've not much database experience. Humor me
here, how do I find the number of books each publisher has?

Thanks,
Kyle
kaf(at)_nwlink_(dot)_com_
remove underscores to reply

Browse pgsql-sql by date

  From Date Subject
Next Message Mitch Vincent 1999-12-17 18:50:06 Sub-select speed.
Previous Message Tom Lane 1999-12-17 17:09:24 Re: [SQL] select with group by problem