Slide

543 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
543
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Slide

  1. 1. SQL vs. XQuery Radu Potop
  2. 2. What is SQL? ● Structured Query Language ● Works with RDBMS ● Operates on tables ● Developed in 1974 by IBM
  3. 3. What is SQL? My_table Example: field1 field2 field3 test N NULL INSERT INTO My_table (field1, field2, field3) VALUES ('test', 'N', NULL); UPDATE My_table SET field1 = 'updated value' WHERE field2 = 'N';
  4. 4. What is XQuery? ● Query language ● Works with XML data collections ● Operates on hierarchies ● W3C recommendation in 2007
  5. 5. What is XQuery? Example (applied to book.xml): for $x in doc("books.xml")/bookstore/book where $x/price>30 order by $x/title return $x/title for $x in doc("books.xml")/bookstore/book return if ($x/@category="CHILDREN") then <child>{data($x/title)}</child> else <adult>{data($x/title)}</adult>
  6. 6. More about XQuery ● Supported by most RDBMS ● Supports XPath ● Not yet an ISO/ANSI standard (like SQL) ● Currently a read-only language
  7. 7. More about XQuery ● Immature, unknown, lacking dev. tools and communities ● Open-source implementations ● Not as efficient as SQL (for now)
  8. 8. Resources http://newton.typepad.com/content/2006/09/sql_vs_xpath_vs.html http://gcn.com/articles/2005/03/16/sql-vs-xml-in-a-database-world.aspx http://en.wikipedia.org/wiki/Xquery http://en.wikipedia.org/wiki/SQL http://www.w3schools.com/xquery/
  9. 9. Thank you

×