Re: Need help with a college SQL exam question...
От | Arian Prins |
---|---|
Тема | Re: Need help with a college SQL exam question... |
Дата | |
Msg-id | 3C0C8F53.26701052@zonnet.nl обсуждение исходный текст |
Ответ на | Need help with a college SQL exam question... (dejauser2001@yahoo.co.uk (dejauser2001@yahoo.co.uk)) |
Список | 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@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
В списке pgsql-sql по дате отправления: