2017-10-08 4 views
-1

XQuery를 사용하여 가장 높은 가격을 얻는 방법? 나는 XML과 XQuery의 기초를 배우려고 노력하고 있으며, 미리 감사드립니다!Xquery를 사용하여 가장 높은 가격을 얻는 방법

<catalog> 
    <book id="bk101"> 
     <author>Gambardella, Matthew</author> 
     <title>XML Developer's Guide</title> 
     <genre>Computer</genre> 
     <price>44.95</price> 
     <publish_date>2000-10-01</publish_date> 
     <description>An in-depth look at creating applications 
     with XML.</description> 
    </book> 
    <book id="bk102"> 
     <author>Ralls, Kim</author> 
     <title>Midnight Rain</title> 
     <genre>Fantasy</genre> 
     <price>5.95</price> 
     <publish_date>2000-12-16</publish_date> 
     <description>A former architect battles corporate zombies, 
     an evil sorceress, and her own childhood to become queen 
     of the world.</description> 
    </book> 
</catalogue> 

답변

2

가장 높은 가격은 max(//price)입니다. 가장 높은 가격의 책을 원한다면 가장 간단한 방법은 //book[price=max(//price)]이지만, 이것이 가장 효율적일 필요는 없습니다 (옵티 마이저에 따라 다름).

관련 문제