pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arian Prins <prinsarian@zonnet.nl>
To: pgsql-sql@postgresql.org
Subject: Re: Need help with a college SQL exam question...
Date: Tue, 04 Dec 2001 09:54:43 +0100
Message-ID: <3C0C8F53.26701052@zonnet.nl> (raw)
References: <383ef96c.0111290754.4ab26b07@posting.google.com>

Hi,

Nice question.... I made a nice query that'll get you the result. I will not give
you the code because: 1. it's your exam, 2. I think It has some "rough edges" and
I don't want you to get the blame of my "edges" :-)

I'll give you a narrative version:

1. I'm counting the number of distinct makes...
2. I'm counting the number of distinct makes every customer has ever used (join,
join, join!) and compare that number to the result of #1

This of course happens in subqueries. I do not use HAVINGs though...
And on the design of the exam-database; lousy.

Succes,
A. Prins.

"dejauser2001@yahoo.co.uk" schreef:

> Hi everyone,
>
> Its coming close to my January examinations, and
> while revising I got stuck in the follwing question.
> I literally spent hours trying to solve it but I
> just can't :(
>
> Consider the folowing relations; (where the * means
> primary key)
>
> The "Car Rental" database
> -------------------------
>
> customer(*cust_num*,cust_name)
> hire(*car_reg*,*cust_num*,*hire_date*)
> shop(*outlet_code*,address)
> car_model(*model*,make,num_seats,max_speed)
> car(*car reg*,model,year, outlet_code)
>
> And the question is;
> Using SQL (using SELECT, FROM, WHERE, GROUP BY, COUNT(*), etc..) write a query
> to list the names of customers who have borrowed cars made by every maker.
>
> Thats it! Hard or what?
>
> Any help greatly apreciated




view thread (4+ messages)  latest in thread

Message-ID: <3C0C8F53.26701052@zonnet.nl>
Permalink:  ../3C0C8F53.26701052@zonnet.nl/
Also on:    postgresql.org/message-id/3C0C8F53.26701052@zonnet.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: prinsarian@zonnet.nl
  Subject: Re: Need help with a college SQL exam question...
  In-Reply-To: <3C0C8F53.26701052@zonnet.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox