Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:sql:statements:select:order_by [2010/07/03 22:33]
tdo
dev:sql:statements:select:order_by [2016/06/28 22:38] (current)
Line 16: Line 16:
 ===== Discussion ===== ===== Discussion =====
 The //​column_spec//​ can be in the form of [database_name.][table_name.]column_name. ​ The //​column_spec//​ can also be a column alias specified in the //​select_list//​ or the ordinal position of a column in the //​select_list//​. The //​column_spec//​ can be in the form of [database_name.][table_name.]column_name. ​ The //​column_spec//​ can also be a column alias specified in the //​select_list//​ or the ordinal position of a column in the //​select_list//​.
- 
 ===== Examples ===== ===== Examples =====
  
Line 45: Line 44:
   select trans_date, trans_amount - discount NetAmount from trans_table order by NetAmount;   select trans_date, trans_amount - discount NetAmount from trans_table order by NetAmount;
  
-Ascending ​{ASC), Descending (DESC)+Ascending ​(ASC), Descending (DESC)
 DESC (Descending) sorts will NOT be optimized, meaning they may increase the overall elapsed query time. ASC (Ascending) sorts may be optimized, depending on the index installation. Ascending is the default if neither is specified. DESC (Descending) sorts will NOT be optimized, meaning they may increase the overall elapsed query time. ASC (Ascending) sorts may be optimized, depending on the index installation. Ascending is the default if neither is specified.
  
 
Back to top
dev/sql/statements/select/order_by.1278196423.txt.gz ยท Last modified: 2016/06/28 22:38 (external edit)