Storing and querying XML data in a primary table or document utilizes an
index of XML data and includes creating a primary table structure,
creating a primary XML index commensurate with the primary table
structure, populating the primary table and the primary XML index, and
running a query on the XML data in a primary table by utilizing the XML
index. The XML index can be implemented as a node table. The node table
may have a B.sup.+-tree structure and be populated by shredding the XML
values in the primary table. The XML data may be stored as binary large
objects in an XML column of the primary table. Secondary XML indexes may
be created to assist in the search and retrieval of XML data stored in
the primary table. Both the primary XML index and the secondary XML index
tables may be created using data definition language statements.