Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Specification  





2 Standard compliance  





3 Examples  





4 References  





5 External links  














SQL/XML






العربية
Deutsch
Հայերեն
Русский
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


SQL/XMLorXML-Related Specifications is part 14 of the Structured Query Language (SQL) specification. In addition to the traditional predefined SQL data types like NUMERIC, CHAR, TIMESTAMP, ... it introduces the predefined data type XML together with constructors, several routines, functions, and XML-to-SQL data type mappings to support manipulation and storage of XML in a SQL database.

  • SQL:2003-14 defines the basic datatype, mappings, predicates and functions.
  • SQL:2006-14, SQL:2008-14 and SQL:2011-14 expands the older versions and approaches to XQuery.[1]
  • Specification[edit]

    The specification defines the data type XML, functions for working with XML, including element construction, mapping data from relational tables, combining XML fragments, and embedding XQuery expressions in SQL statements. Functions which can be embedded include XMLQUERY (which extracts XML or values from an XML field) and XMLEXISTS (which predicates whether an XQuery expression is matched).

    Further information and examples of the SQL/XML functions are provided in the external links below[2][3][4].

    Standard compliance[edit]

    The result of Wagner's objective evaluation of the SQL/XML:2006 standard compliance of Oracle 11g Release 1, MS SQL Server 2008 and MySQL 5.1.30 is shown in the following table[2], to which the data for PostgreSQL 9.1,[5][6] and IBM DB2 has been added:

    Oracle 11g Release 1 IBM DB2 9.7 MS SQL Server 2008 MySQL 5.1.30 PostgreSQL 9.1
    Datatype XML Partial (Oracle entitles the data type 'XMLType' instead of 'XML') High High No Partial
    SQL/XML predicates High High Partial No Partial
    SQL/XML functions High High Partial Low High
    XQuery augmentation Yes Yes Yes No No

    Examples[edit]

    The sample SQLXML query below has SQLXML type as output(tested on DB2 9.7 and Oracle 11g):

    SELECT XMLELEMENT(NAMEs "PhoneBook", -- root element name
                      XMLAGG(           -- aggregation over the rows 
                      XMLELEMENT(NAME "Contact",                                                  
                      XMLATTRIBUTES(cust.FIRST_NAME AS "Name",
                                    cust.TEL)
                                  )
                            )
                      )
    FROM TMP.CUSTOMER AS cust;
    

    And the output:

    <PhoneBook>
        <Contact Name="Daniel" TEL="788255855"/>
        <Contact Name="Martin" TEL="889665447"/>
        <Contact Name="Eva"    TEL="111222333"/>
        <Contact Name="Alena"  TEL="444555666"/>
        <Contact Name="Oliver" TEL="777888999"/>
        <Contact Name="George" TEL="444882446"/>
        <Contact Name="Jamie"  TEL="123456789"/>
    </PhoneBook>
    

    Samples are taken from javalobby article[7].

    References[edit]

    1. ^ Funderburk, J. E.; Malaika, S.; Reinwald, B. (2002), "XML programming with SQL/XML and XQuery" (PDF), IBM Systems Journal, 41 (4): 642–665, doi:10.1147/sj.414.0642, retrieved 14 November 2011
  • ^ a b Wagner, Michael (2010), "1. Auflage", SQL/XML:2006 - Evaluierung der Standardkonformität ausgewählter Datenbanksysteme, Diplomica Verlag, ISBN 978-3-8366-9609-8
  • ^ Eisenberg, Andrew; Melton, Jim (2004), "Advancements in SQL/XML" (PDF), SIGMOD Record, 33 (3): 79, doi:10.1145/1031570.1031588, retrieved 14 November 2011
  • ^ Eisenberg, Andrew; Melton, Jim (2002), "SQL/XML is Making Good Progress" (PDF), SIGMOD Record, 31 (2): 101, CiteSeerX 10.1.1.109.4867, doi:10.1145/565117.565141, retrieved 14 November 2011
  • ^ PostgreSQL Conformance with ISO 9075-14 (SQL/XML), at PostgreSQL 9.1 documentation.
  • ^ PostgreSQL 9.1 XML functions, at PostgreSQL 9.1 documentation.
  • ^ Kec, Daniel (2013), SQLX - From DB Straight to XML and Back, Javalobby.org
  • External links[edit]


  • t
  • e

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=SQL/XML&oldid=1147037091"

    Categories: 
    SQL
    Database stubs
    Hidden category: 
    All stub articles
     



    This page was last edited on 28 March 2023, at 13:28 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki