SELECT t1, t2, ..., tk, count(r) FROM R GROUP BY t1, t2, ..., tk HAVING count(r) >= T |
SNUM SNAME STATUS CITY ----- ---------- ---------- ---------- s1 Smith 20 London s2 Jones 10 Paris s3 Blake 30 London s4 Clark 20 Paris s5 Adams 30 Athens s6 Brown 20 Rome s7 Klein 5 Rome s8 Green 10 Athens s9 Johnson 15 Atlanta s10 Jackson 10 Rome s11 Bond 10 Atlanta s12 Newton 15 Paris s13 Lofton 15 Athens |
Number of suppliers in each city:
select city, count(snum) from supplier group by city; CITY COUNT(SNUM) ---------- ----------- Paris 3 Atlanta 2 Athens 3 Rome 3 London 2 |
|
|
This is ofcourse an iceberg query...
|
|
|
The Count(F) procedure:
Input: R = input relation F = potential solution of H (|F} << |R|) Variable usage: count[e] = frequency of item e |
|
|
|
|
In this environment, the algorithm can make multiple passes through the data.
In this environment, the algorithm can only make one pass through the data.