summaryrefslogtreecommitdiff
path: root/Year_2/Databases/libri_ex2.xquery
blob: e20b41f3c936bbdfe6fe6d58e2878a609959aabc (plain)
1
2
3
4
5
6
7
8
9
let $f := doc("libri.xml")
let $authors := $f//autore

for $author in distinct-values($authors)
let $books := $f//libro[autore=$author]
return <author>
            <name>{ $author }</name>
            <num>{ count($books) }</num>
       </author>