16.10.2015 Views

Getting Started with DB2 Express-C

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

264 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>DB2</strong> <strong>Express</strong>-C<br />

15.3 XML in <strong>DB2</strong><br />

Figure 15.3 below outlines how relational data and hierarchical data (XML documents) are<br />

both stored in a <strong>DB2</strong> hybrid database. The figure also shows the CREATE TABLE<br />

statement that was used to create the table dept.<br />

Figure 15.3 – XML in <strong>DB2</strong><br />

Note that the table definition uses a new data type, XML, for the deptdoc column. The<br />

left arrow in the figure indicates the relational column deptID stored in relational format<br />

(tables), while the XML column deptdoc is stored in parsed hierarchical format.<br />

Figure 15.4 illustrates that in <strong>DB2</strong> 9, there are now four ways to access data:<br />

• Use SQL to access relational data<br />

• Use SQL <strong>with</strong> XML extensions (SQL/XML) to access XML data<br />

• Use XQuery to access XML data<br />

• Use XQuery to access relational data<br />

Figure 15.4 – Four ways to access data in <strong>DB2</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!