Received: from mail.astrofoto.org (dsl092-102-177.nyc2.dsl.speakeasy.net [66.92.102.177]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fB4ElAm88413 for ; Tue, 4 Dec 2001 09:47:10 -0500 (EST) (envelope-from roland@astrofoto.org) Received: (from roland@localhost) by mail.astrofoto.org (8.11.6/8.11.6) id fB4ElEA26626; Tue, 4 Dec 2001 09:47:14 -0500 To: pgsql-sql@postgresql.org Subject: Re: Need help with a college SQL exam question... References: From: Roland Roberts Date: 04 Dec 2001 09:47:13 -0500 In-Reply-To: Message-ID: Lines: 23 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.105 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200112/35 X-Sequence-Number: 5858 >>>>> "Josh" == Josh Berkus writes: Josh> It's doable. Just think "nested subselects" and heavy use Josh> of the HAVING clause. They're also screwing with you by Josh> providing an irrelevant table (shop) and not providing a Josh> relevant table (makers). If I was the professor, I'd give Josh> the question writer a D+ for database design ... I would treat the table car_model as providing a complete list of makes as well, i.e., "select distinct make from car_model" provides a list of all car makes (from which the customer can borrow). I'd agree that the database *should* have a makers table to constrain the values of that column. A real-life database without it is prone to *lots* of data entry errors (let's see, should I put in GM, Chevy or Chevrolet?). roland -- PGP Key ID: 66 BC 3B CD Roland B. Roberts, PhD RL Enterprises roland@rlenter.com 76-15 113th Street, Apt 3B roland@astrofoto.org Forest Hills, NY 11375