65
XQuery
•
Find book titles by the coauthors of “Database
Theory”:
FOR
$x
IN
bib
/
book[title
/text() = “Database Theory”
]/author
$y
IN
bib
/
book[author
/text() =
$x
/text()]/
title
RETURN
<
answer
> {
$y
/text() } </
answer
>
Result:
<
answer
> abc </
answer
>
<
answer
> def </
answer
>
<
answer
> ghi </
answer
>
The answer will
contain duplicates !