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/ex5.xq
2022-03-29 17:16:02 +02:00

30 lines
602 B
Plaintext

<xoxo>
<more>
{
let $morek := //PLANT[AVAILABILITY > 100000]
order by $morek/COMMON
return $morek/COMMON
}
</more>
<light>
{
for $l in distinct-values(//LIGHT)
return element {replace($l," ","_")} {//PLANT[LIGHT = $l]/COMMON}
}
</light>
<pz3>
{
sum(for $zone3 in //PLANT[ZONE = "3"]
return $zone3/PRICE *$zone3/AVAILABILITY)
}
</pz3>
<price>
{
for $l in distinct-values(//LIGHT)
let $p := //PLANT[LIGHT = $l]
let $mp := $p[PRICE = max($p/PRICE)]
return element {replace($l," ","_")} {<name>{$mp/COMMON/text()}</name>,<price>{$mp/PRICE/text()}</price>}
}
</price>
</xoxo>