There are three XML documents: purchaseorders.xml, products.xml and customerinfo.xml.
These documents are also available in DB2 sample database as purchaserorder(porder), product(description),
(Some example queries from course lectures can be found XQueryExamples.zip.)
You will write XML queries with Oxygen XML or DB2.
(Please use XPath/XQuery builder view in Oxygen to edit and run the queries, otherwise you may run into a sequence error.)
Query 1. XPath (6 points):
a. Write an XPath query to return purchase order numbers for those shipped orders containing an item with partid “100-
b. Using customerinfo.xml, write an XPath query to return the name(s) of customers who live in the city “Toronto” and have
an assistant. Return names as text only.
Query 2. XQuery (4 points): Write an XQuery to return the total cost (total quantities from multiple orders multiplied by
the price) for each unique product (represented by partid or pid) in all purchase orders, sorted by partid.
The result format should look like:
(Hint: You may want to group by partid using purchaseorders.xml and find the price for each product using products.xml. )
Submission: please zip your query files and results (as text files or screenshots) and submit at blackboard.
Copyrights by Dr. Fusheng Wang Č
Fusheng Wang, Apr 26, 2020, 2:02 PM v.1 ď
Fusheng Wang, Apr 26, 2020, 2:01 PM v.1 ď