Techniques are provided for XML data storage and query rewrites in relational
databases. According to certain embodiments of the invention, a mechanism is provided
to allow the user to store an XML document in a relational database and to submit
mapping information that indicates a mapping of each field of the XML document
to the column in the relational database in which the data from each field is stored.
If the user submits an XML query to access the data in the XML document that is
stored in the relational database, then a mechanism is provided to generate a database
query based on the XML query and the mapping information.