We study the query language BQL: the extension of the relational algebra wi
th for-loops. We also study FO(FOR): the extension of first-order logic wit
h a for-loop variant of the partial fixpoint operator. In contrast to the k
nown situation with query languages, which include while-loops instead of f
or-loops, BQL and FO(FOR) are not equivalent. Among the topics we investiga
te are: the precise relationship between BQL and FO(FOR); inflationary vers
us noninflationary iteration the relationship with logics that have the abi
lity to count: and nested versus unnested loops. (C) 2001 Academic Press.