This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
TP-BDD2/xquery/ex4.xq
2022-03-29 17:16:02 +02:00

41 lines
967 B
Plaintext

<truc>
<acteurs>
{
for $act in //ACTEURS/acteur
return <acteur name="{$act}">
{
for $film in //FILMS/film[$act/@id = cast/acteur/@id]
return <film>{$film/titre/text()}</film>
}
</acteur>
}
</acteurs>
<films>
{
for $film in //FILMS/film
let $c := count($film/cast/acteur)
order by $c
let $y := $film/@annee
let $actA := $y * $c - sum(//ACTEURS/acteur[@id = $film/cast/acteur/@id]/@naissance)
return <film mean="{$actA div $c}">{$film/titre/text()}</film>
}
</films>
<noBill>
{
let $billID := //ACTEURS/acteur[. = "Bill Murray"]/@id
let $billFilms :=//FILMS/film[cast/acteur/@id = $billID]
let $act := //ACTEURS/acteur[not(@id = $billFilms/cast/acteur/@id)]
return $act
}
</noBill>
<couples>
{
let $fs := //ACTEURS/acteur[@sexe = "F"]
let $ms := //ACTEURS/acteur[@sexe = "M"]
for $m in $ms
for $f in $fs
return <couple><femme>{$f/text()}</femme><homme>{$m/text()}</homme></couple>
}
</couples>
</truc>