[thelist] DB "Limit" Command Question
Edward McCarroll
Ed at ComSimplicity.com
Thu Apr 16 14:24:28 CDT 2009
> 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?
MS SQL Server offers "SELECT TOP <N> ..." which, when used without
an "ORDER BY" clause, returns N random rows. (AFAIK, there's no
"limit output to 20 records" clause.)
I refuse to believe that any respectable DBMS would scan an entire
table if the goal was to find "N random rows".
But then again, those open-source folks have been known to take an
approach that differs from Micro$oft's. </troll>
"Some people really do prefer to curse the darkness." (Ed McCarroll)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll Ed at ComSimplicity.com
PO Box 654 (310) 904-3651
Culver City, CA 90232 www.ComSimplicity.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
More information about the thelist
mailing list