Q3
Single choice
Given the following CREATE TABLE statement: CREATE TABLE customer(custid INTEGER, info XML)
And the following INSERT statements: INSERT INTO customer VALUES (1000,
'<customerinfo xmlns="http://custrecord.dat" custid="1000"> <name>John Doe</name>
<addr country="United States">
<street>25 East Creek Drive</street>
<city>Raleigh</city>
<state-prov>North Carolina</state-prov>
<zip-pcode>27603</zip-pcode>
</addr>
<phone type="work">919-555-1212</phone>
<email>[email protected]</email>
</customerinfo>');
INSERT INTO customer VALUES (1000, '<customerinfo xmlns="http://custrecord.dat" custid="1001"> <name>Paul Smith</name> <addr country="Canada"> <street>412 Stewart Drive</street> <city>Toronto</city> <state-prov>Ontario</state-prov> <zip-pcode>M8X-3T6</zip-pcode> </addr> <phone type="work">919-555-4444</phone> <email>[email protected]</email> </customerinfo>');
What is the result of the following XQuery expression?
XQUERY declare default element namespace "http://custrecord.dat"; for $info in db2-fn:xmlcolumn
('CUSTOMER.INFO')/customerinfo where $info/addr/state-prov="Ontario" return $info/name/text();