<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 1 Jun 2015, at 19:08, Ihe Onwuka <<a href="mailto:ihe.onwuka@gmail.com" class="">ihe.onwuka@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Then I have some questions.</div><div class=""><br class=""></div><div class="">So what happens to the closure property.</div></div></div></blockquote><div><br class=""></div>Well, if you’re going to apply SQL to JSON (say), then the first thing you have to do is define a mapping from JSON to tables. That’s not difficult to do.</div><div><br class=""></div><div>If by the “closure property” you want the result of any SQL query to be the representation of some JSON structure, then you’re not going to achieve that. That’s essentially the same as the update problem.</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div>Should I be allowed to join a JSON array with an object. </div></div></blockquote><div><br class=""></div><div>No, you don’t join arrays with objects (maps). You join the table representation of an array with the table representation of a map. And what you get back is a table, which of course you can query.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">Why not, or if so what type of thing will I get back and what will happen when if I try to query it (I will be allowed to query it won't I).<div class=""><br class=""></div><div class="">If I ask to order by a field and there is no schema to tell me it's type what is SQL going to do.</div></div></div></blockquote><div><br class=""></div>JSON types are based on the syntax of the instance, not on any schema. If it looks like a number then it is a number. 4=4.0 is true, “4”=“4.0” is false.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Talking of ordering how do I get the 5th array item or the 5th object when SQL only deals in unordered sets.</div></div></div></blockquote><div><br class=""></div>SQL doesn’t deal only in unordered sets. It deals in tables. It has an “order by” operator. You’re probably thinking of the relational model, which is not the same as SQL.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">What would be the result of union of two objects and how can I determine whether such a union should be allowed at all when there is no schema?</div></div></div></blockquote><div><br class=""></div>Again, it’s the union of two tables which are the representations of objects/maps, and the details depend on how you do the mapping.</div><div><br class=""></div><div>Michael Kay</div><div>Saxonica<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><br class=""></div></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
_______________________________________________<br class="">
<a href="mailto:talk@x-query.com" class="">talk@x-query.com</a><br class="">
<a href="http://x-query.com/mailman/listinfo/talk" target="_blank" class="">http://x-query.com/mailman/listinfo/talk</a></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>