I hope I'm asking in the right place. I don't think this is appropriate for stackoverflow.
In Microsoft Sql Server (MSSQL) and Oracle SQL (T-SQL), if you perform the following query:
select a.*,b.* from A as [a], A as [b]
On the following data in set A:
ID,Value
1,a
2,b
3,c
4,d
5,e
The result set will be
A.id,A.value,B.id,B.value
1,a,1,a
2,b,1,a
3,c,1,a
4,d,1,a
5,e,1,a
1,a,2,b
2,b,2,b
3,c,2,b
4,d,2,b
...
Why was this order chosen and defined for an unrestricted self-join? I guess, my question is - is this result the same between Oracle and Microsoft because the result is rooted in relational algebra/set theory somewhere, which is rooted in some mathematical principle? If so, where can I learn more about this?
Or, is there no mathematical reason for this ordering and it's purely coincidence based on language implementation / performance?
My initial assumption when running into this was that it would automatically be ordered like this:
1,a,1,a
1,a,1,a
1,a,1,a
1,a,1,a
1,a,1,a
2,b,2,b
2,b,2,b
2,b,2,b
2,b,2,b
2,b,2,b