XML QUERY LANGUAGES: XQUERY AND XPATH WHERE clause

XML QUERY LANGUAGES: XQUERY AND XPATH WHERE clause is based on existence (this is known as existential qualification), the SQL one is not. Both XQuery let and SQL s SET can be used for assignment, though let can be used as an adjunct to for inside a FLWOR expression. SET in SQL is usually a clause in a SQL UPDATE statement or a standalone statement in a SQL batch or a stored procedure. In fact, in Transact-SQL, SELECT can also be used for assignment. Though some of the matches are not 100% exact, it should not be a big stretch for SQL users to learn XQuery. The ease of adoption by SQL programmers, rather than data models served, is probably the reason for relational database vendors (or for that matter, OODBMS vendors, since XQuery also resembles OQL) to embrace XQuery over the functionally equivalent XSLT language. SQL and XQuery differ with respect to their data models. Attributes (column values) in SQL usually have two possible value spaces: an atomic value or NULL. Having NULL complicates some of the SQL operations; for example, NULLs are not included by default in aggregate operations. XQuery has the NULL sequence (a sequence with zero items), which has some of the same semantics (and complications) as the SQL NULL. In addition, XQuery has to deal with complications of nodes versus atomic values as well as the complications of possibly hierarchical nodes or multivalue sequences. This makes some of the rules for XQuery quite complex. As an example, value comparisons between unlike data types in SQL are not possible without casting (although SQL Server performs implicit casting in some cases). Comparing a value with NULL (including NULL) is always undefined. This rule could be stated in two sentences with two cases. Contrast this to the rules for value comparison in XQuery. 1. Atomization is applied to each operand. If the result is not an empty sequence or a single atomic value, a type error is raised. 2. If either operand is an empty sequence, the result is an empty sequence. 3. If either operand has the most specific type xdt:untypedAtomic, that operand is cast to a required type, which is determined as follows: 4. If the type of the other operand is numeric, the required type is xs:double. 5. If the most specific type of the other operand is xdt:untypedAtomic, the required type is xs:string. 6. Otherwise, the required type is the type of the other operand.

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services

Bookmark the permalink.

Comments are closed.