What does the SQL standard and its mainstream DB implementations (SQL Server, Oracle, DB2, PostgreSQL, Firebird, MySQL, etc.) say about the final order in the following general case:
SELECT * FROM (SELECT * FROM Table t ORDER BY t.Field)
Can I trust that the inner order is respected by the outer projection as well or do I need to state the
ORDER BY in the outer statement explicitly, to be sure?
I understand the recommendation to "explicitly list it". However, explicit listing can cause problems in certain cases. PostgreSQL, for one, requires that all fields listed in
ORDER BY be listed in
SELECT DISTINCT as well. That's no good in some cases, because it changes the expected result set, which could no longer be distinct in light of the single column I'm interested in.