解决方法
你不能,至少不可靠.
某些sql实现可能会按主键或聚簇索引的顺序返回行,但sql本身是一个关系代数,它返回任意有序的集合,除非另有说明.
返回行的顺序很可能很大程度上取决于创建表后的插入和删除活动.
我对这样的面试问题的回答是:
Is there some sort of reason why we can’t use ‘order by’ in our queries? Is the company so hard up for money that they cannot afford the disk space to store those extra few bytes for each query? Are you out of you goddamned mind? Ask me a question that’s going to have some relevance 原文链接:https://www.f2er.com/mssql/77402.html