Details
-
Task
-
Status: Resolved
-
Resolution: Fixed
-
None
-
None
-
None
-
29
Description
Using the stock symbol example, if we do these queries:
```sql
SELECT SYMBOL FROM STOCK_SYMBOL ORDER BY SYMBOL DESC LIMIT 3;
SELECT SYMBOL FROM STOCK_SYMBOL ORDER BY SYMBOL ASC LIMIT 3;
```
One would expect different symbols in each set. Instead we get this result:
```
SYMBOL
----------
GOOG
CRM
AAPL
SYMBOL
----------
AAPL
CRM
GOOG
```
Which implies that the LIMIT was applied first, then ORDER BY. I could be wrong but I believe most databases would not evaluate these expressions in that order.