[thelist] DB "Limit" Command Question

Nick Brogna nick at wemakepretty.com
Thu Apr 16 14:09:26 CDT 2009

Sloppy, quick example...

SELECT field1,field2 FROM table ORDER BY field1 ASC LIMIT 20;

You can (loosely) break down the order of operations in the above  
query like so:
  	- Get all the contents of columns field1 and field2 from the table  
	- Sort our newly obtainted dataset by the value of field1 (lowest to  
	- limit our dataset to be returned by the query to the first 20  
records in the newly sorted dataset and return those.

Nick Brogna

On Apr 16, 2009, at 11:18 AM, Luther, Ron wrote:

> Hi Gang,
> Okay, I'm pretty sure that if I run a query containing both a clause  
> to limit output to 20 records AND a clause to sort or order the data  
> in some way that the query will execute through the entire table  
> (data model) and then limit the output sent back to the viewport to  
> the 20 records I specified.
> But what if I don't?
> What if I run a 'select field1, field2, field3 from tableA' that  
> contains a 'limit output to 20 records" clause?
> Does it run through the whole table and then return 20 records?  Or  
> does it stop executing at 20 records and return?
> Quizzically,
> RonL.
> [Yeah, the answer might very well vary by DBMS.  Anybody got answers  
> for any popular DBs?]
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !

More information about the thelist mailing list