10. A method of operating a digital computer for executing an outer query including a nested inner query, said inner query referencing a first relation also referenced in said outer query, said inner query including a first predicate joining said first relation to a second relation, said inner query also including a count aggregate, said outer query having a second predicate referencing said first relation and said inner query, said method comprising the steps of: a) computing a third relation including values of said second relation by counting over groups of distinct values of said second relation to compute a count for each distinct value of said second relation; and b) applying said first predicate to combinations of values of said first relation and the distinct values of said second relation, and for combinations of values of said first relation and distinct values of said second relation which satisfy said first predicate, applying said second predicate to said first relation and the count of said third relation for each distinct value of said second relation, and for values of said first relation for which said first predicate is not satisfied in combination with any of said distinct values of said second relation, applying said second predicate to said first relation and a value of zero.
17. The method as claimed in claim 10, wherein said step (b) of applying includes indexing said third relation with a first index and indexing all values of said first relation with a second index, and for each value of said first relation, sequencing said first index and iteratively testing said first predicate with said each value of said first relation and one of said values of said second relation indexed by said first index, and when said testing finds that said first predicate is true, testing said second predicate with said each value of said first relation and the count for the indexed one of said values of said second relation and terminating said testing of said first predicate with said each value of said first relation, and when said testing has tested said first predicate for said each value of said first relation and all of said values of said second relation from said third relation without ever finding that said first predicate is true, applying said second predicate to said each value of said first relation and a value of zero.