Maison > Article > base de données > mysql的默许排序规则探讨
mysql的默认排序规则探讨 3个SQL语句的不同结果(注意sid的值): ? mysql? select ? sid,order_no,order_status? from ? oms_order???limit?10; + -----+----------------+--------------+ |?sid?|?order_no???????|?order_status?| + -----+---------------
mysql的默认排序规则探讨
3个SQL语句的不同结果(注意sid的值):
?
mysql>?
select
?sid,order_no,order_status?
from
?oms_order???limit?10;
+
-----+----------------+--------------+
|?sid?|?order_no???????|?order_status?|
+
-----+----------------+--------------+
|??20?|?20100319000003?|????????????0?|
|??21?|?20100319000004?|????????????0?|
|??63?|?20100319000046?|???????????-1?|
|??69?|?20100320000006?|????????????0?|
|??76?|?20100323000001?|????????????0?|
|??77?|?20100323000002?|????????????0?|
|??78?|?20100323000003?|????????????0?|
|??79?|?20100323000004?|????????????8?|
|??86?|?20100324000007?|???????????-1?|
|??93?|?20100324000014?|???????????-1?|
+
-----+----------------+--------------+
10?
rows
?in
?set
?(0.00?sec)
?
mysql><span>?</span>
select
?sid,order_status?
from
?oms_order???limit?10;
+
-----+--------------+
|?sid?|?order_status?|
+
-----+--------------+
|?240?|???????????-1?|
|?261?|???????????-1?|
|?263?|???????????-1?|
|?285?|???????????-1?|
|?286?|???????????-1?|
|?288?|???????????-1?|
|?339?|???????????-1?|
|?383?|???????????-1?|
|?387?|???????????-1?|
|?452?|???????????-1?|
+
-----+--------------+
10?
rows
?in
?set
?(0.00?sec)
?
mysql>?
select
?sid?
from
?oms_order???limit?10;
+
---------+
|?sid?????|
+
---------+
|?1171641?|
|?1171651?|
|?1171661?|
|?1171671?|
|?1171681?|
|?1171691?|
|?1171701?|
|??????20?|
|??????21?|
|??????63?|
+
---------+
10?
rows
?in
?set
?(0.00?sec)
?
排序规则:
?