So the table would be (potentially) sorted prior to executing the code?

Yes...assumptions.