comparing XQuery and SQL

Is there anything to comapre between XQuery & SQL.
As far as I understand, XQuery is born to query hierarchical data and SQL for relational. Besides this difference, what similarities/differences are there between these two? Is it wise to compare these two.
Plz correct me if I’m missing something.
Thanks a bunch in advance!

I haven’t seen a detailed comparison of XQuery and SQL - and doing such a comparison would involve writing a substantial paper. At the first level, the scope of XQuery is much smaller: SQL does data definition and update as well as query, whereas XQuery 1.0 only does query. XQuery is in that sense closer to the object query language OQL.

The other differences, as you point out, are mainly concerned with the differences in the data model. But there are many conceptual similarities: both are declarative expression languages without side effects, both are strongly typed, both are built on the mathematical foundations of first-order predicate calculus, both are closed with respect to their respective data models (relations for SQL, XML trees for XQuery).

Michael Kay