Bernt M. Johnsen wrote:
> Tim Dudgeon wrote:
>>
>> Yes, but is there an equivalent to the TOP or LIMIT keywords that other
>> databases use?
>
> Not in SQL (neither in Derby nor the SQL standard).
> The closest equivalent is Statement.setMaxRows(i).
>
So that would not be applied at the query level?
Statement stmt = con.createStatement();
stmt.setMaxRows(1);
stmt.execute("SELECT * FROM a_very_large_table");
would run very inefficiently?
And how about
SELECT * FROM a_very_large_table ORDER BY some_column ?
using a SQL keyword like TOP or LIMIT presumably allows these to be
optimised in some way, but stmt.setMaxRows(1) does not?
Tim
|