XMLマスター:プロフェッショナル(データベース) 出題傾向【予想】

教科書(緑本)第4章、練習問題4-8以降要注意。タプルストリームをイメージすることが大事。復習すること。ただ、練習問題4-11からは教科書に、実際の試験ではここまでのクエリー式の解読は要求されないでしょうとある。

練習問題4-9

選択肢Cの結果はこうなるのか……ってよく考えると当然だな。

<menu code="m1">
  <student>鈴木</student>
</menu>
<menu code="m1">
  <student>佐藤</student>
</menu>
<menu code="m2">
  <student>山田</student>
</menu>
<menu code="m2">
  <student>小林</student>
</menu>
<menu code="m2">
  <student>鈴木</student>
</menu>
<menu code="m3">
  <student>山田</student>
</menu>
<menu code="m3">
  <student>松野</student>
</menu>
<menu code="m4">
  <student>小林</student>
</menu>
<menu code="m4">
  <student>松野</student>
</menu>
<menu code="m5">
  <student>松野</student>
</menu>
<menu code="m5">
  <student>大塚</student>
</menu>
<menu code="m5">
  <student>渡辺</student>
</menu>

2重ループするから、$stuでループして、$codeでもループして、何回もmenu要素が生成されてしまう。でも実際の試験で焦ると、なんか迷って時間とられそうだ。