To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

From Wikipedia, the free encyclopedia

The programming language XQuery defines FLWOR (pronounced 'flower') as an expression that supports iteration and binding of variables to intermediate results. FLWOR is an acronym: FOR, LET, WHERE, ORDER BY, RETURN.[1] FLWOR is loosely analogous to SQL's SELECT-FROM-WHERE and can be used to provide join-like functionality to XML documents.

  • for creates a sequence of nodes
  • let binds a sequence to a variable
  • where filters the nodes on a boolean expression
  • order by sorts the nodes
  • return gets evaluated once for every node

YouTube Encyclopedic

  • 1/3
    Views:
    1 058
    7 721
    34 526
  • SQL 2008 Flwor Lab 6.2
  • XQuery: Consultas
  • 2. XQuery

Transcription

Example

   for $d in doc("depts.xml")//deptno
   let $e := doc("emps.xml")//employee[deptno = $d]
   where count($e) >= 10
   order by avg($e/salary) descending
   return
     <big-dept>
        { $d,
           <headcount>{count($e)}</headcount>,
           <avgsal>{avg($e/salary)}</avgsal>
        }
     </big-dept>

First column of the XQuery request shows the for, let, where, order by and return keywords of the FLWOR paradigm. In plain English, this could be read as "Get all departments that have more than ten employees, order these departments by decreasing average salary, and return a report of department numbers, head counts and average salary in each big department". The result could look like:

<big-dept>
    <deptno>17</deptno>
    <headcount>25</headcount>
    <avgsal>12500</avgsal>
</big-dept>
<big-dept>
    <deptno>24</deptno>
    <headcount>18</headcount>
    <avgsal>11327</avgsal>
</big-dept>
<big-dept>
    <deptno>3</deptno>
    <headcount>32</headcount>
    <avgsal>10725</avgsal>
</big-dept>

Example using Microsoft SQL Server

DECLARE @xml XML

SET @xml = 
'<root_element>
	<branch_element>
		<item_1>42</item_1>
		<item_2>27</item_2>
	</branch_element>
	<branch_element>
		<item_1>a</item_1>
		<item_2>b</item_2>
	</branch_element>
</root_element>'

SELECT 
		x.y.query('for $s in self::node() return $s//item_1/text()') as i,
		x.y.query('for $s in self::node() return $s//item_2/text()') as j
	FROM @xml.nodes('/root_element') AS x(y);

References

  1. ^ Walmsley, Priscilla (2007). XQuery. Sebastopol, CA, USA: O'Reilly Media. p. 73. ISBN 978-0-596-00634-1.

External links


This page was last edited on 1 July 2023, at 04:45
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.