Re: Need help with a college SQL exam question...

From: Arian Prins <prinsarian(at)zonnet(dot)nl>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Need help with a college SQL exam question...
Date: 2001-12-04 08:54:43
Message-ID: 3C0C8F53.26701052@zonnet.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)yahoo(dot)co(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Manuel Trujillo 2001-12-04 11:10:47 problems with this wiew
Previous Message Arian Prins 2001-12-04 08:31:30 Re: need some help understanding sloq query