Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 3rd, 2004, 04:06 PM
jayjoh jayjoh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 4 jayjoh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question limit

I'm totally new to Firebird (as in, I just installed and downloaded ... oops, other way around ... this week).

My first gotcha: Other SQL databases have clauses like "top" and "limit" to restrict the size of the result set. Is there anything equivalent in Firebird?

I'm using Firebird from Java with JayBird. In JDBC there's Statement.setMaxRows, which appears to do the job, but I'm a bit nervous about that: Is it actually passing that limit to the database engine? Or is the engine going to create a result set with a million rows and then JDBC is going to throw out all but the first 20, thus wasting time and memory all around? Similarly, I could create the result set and then just close it after processing the first twenty rows and ignore the rest, but again, do I still pay the performance penalty of the full result in such a case?

Reply With Quote
  #2  
Old September 5th, 2004, 06:53 PM
russh russh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 18 russh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 48 sec
Reputation Power: 0
Hi,

I assume you're looking for the FIRST and SKIP clauses. They are used like this:

SELECT FIRST X SKIP Y
field1, field2, fieldn
FROM
... etc.

Fill in X and Y as appropriate. Think this was only introduced in firebird 1.5 though (not sure - definitely not an interbase feature).

Hope this helps,
Russ

Reply With Quote
  #3  
Old September 5th, 2004, 06:54 PM
russh russh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 18 russh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 48 sec
Reputation Power: 0
Quote:
Originally Posted by russh
Hi,

I assume you're looking for the FIRST and SKIP clauses. They are used like this:

SELECT FIRST X SKIP Y
field1, field2, fieldn
FROM
... etc.

Fill in X and Y as appropriate. Think this was only introduced in firebird 1.5 though (not sure - definitely not an interbase feature).

Hope this helps,
Russ


Oh, and SKIP is optional.

Russ

Reply With Quote
  #4  
Old September 6th, 2004, 11:02 AM
jayjoh jayjoh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 4 jayjoh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Quote:
Originally Posted by russh
Hi,

I assume you're looking for the FIRST and SKIP clauses. ...


Ahhhh. Thanks.

Funny how every database product I use, the SQL is just different enough to be confusing. It's like talking to someone from Australia, you think you should understand each other because you both speak English, and then he says something that just leaves you saying, Huh?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > limit


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway