Ralph,
Assuming that there is no history in the BIDS table (meaning that there are
no old records indicating a bid recorded last year), I think the following
would work just fine.
select name
from person,
(select distinct sid, count(*) bid_count
from bids
group by sid) bids
where
- --- Original Message --- -
From: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L
[EMAIL PROTECTED]
Sent: Mon, 29 Sep 2003 05:19:39
Im taking a database theory class(no I dont need
help with my homework). There is an interesting
query in the book that I have never
select pn.name
from (select /*+ no_merge */ count(*) boat_cnt from boat) bt, bid bd,
person pn
where bd.sid = pn.sid
group by pn.name, boat_cnt
having count(bd.boat_id) = boat_cnt
Waleed
-Original Message-
Sent: Monday, September 29, 2003 9:20 AM
To: Multiple recipients of
From: Stephane Faroult [EMAIL PROTECTED]
Date: 2003/09/29 Mon AM 09:59:39 EDT
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Subject: RE: interesting sql question
- --- Original Message --- -
From: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE
Title: RE: RE: interesting sql question
Here is an attempt ...
select p.*
from persons p
where sid in
(select sid, count(bid)
from bids
group by sid
having count(sid) = (select count(boad_id) from boats))
/
You wanted to find all persons who have booked all boats ... add criteria
This would eliminate duplicate bids on the same boat by the same person
SELECT p.*
FROMPERSON p,
(
SELECT COUNT(*) boat_count
FROMBOAT
) c,
(
SELECT sid, COUNT(DISTINCT boat_id) bid_count
FROMBIDS
GROUP BY sid
a user may request the same boat more than once. not sure that work.
From: Jamadagni, Rajendra [EMAIL PROTECTED]
Date: 2003/09/29 Mon AM 10:34:53 EDT
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Subject: RE: RE: interesting sql question
Here is an attempt ...
select p
Title: RE: RE: interesting sql question
Hey ... the question wasn't complete ...
give us the full statement of the question ...
g
Raj
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed
: RE: interesting sql question
Ralph,
Assuming that there is no history in the BIDS table (meaning that there are
no old records indicating a bid recorded last year), I think the following
would work just fine.
select name
from person,
(select distinct sid, count(*) bid_count
from
, Thomas F [EMAIL PROTECTED]
Date: 2003/09/29 Mon PM 12:29:40 EDT
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Subject: RE: RE: interesting sql question
yeah! I think it *is* homework :)
Tom
-Original Message-
Sent: Monday, September 29, 2003 12:10 PM
10 matches
Mail list logo