这个查询:
SELECT *
FROM html
WHERE url='http://wwww.example.com'
AND xpath='//tr[@height="20"]'
返回 XML:
<results>
<tr height="20">
<td height="20" width="425">
<p>Institution 0</p>
</td>
<td width="134">
<p>Minneapolis</p>
</td>
<td width="64">
<p>MN</p>
</td>
</tr>
...
</results>
问题:
- 有没有办法使用 XPATH 创建单独的列?
- 有没有办法创建列别名?
示例(无效语法):
SELECT td[position()=1]/p/. AS name, td[position()=2]/p/. AS city, td[position()=3]/p/. AS region
FROM ...
目标:
<results>
<tr height="20">
<name>Institution 0</name>
<city>Minneapolis</city>
<region>MN</region>
</tr>
...
</results>