To make Limit clause as I typically do in MySQL

Asked By 0 points N/A Posted on -
qa-featured

How can I make Limit clause as I typically do in MySQL?  Will you please help me? Thanks! 

SHARE
Best Answer by Allen Kenneth
Answered By 0 points N/A #104876

To make Limit clause as I typically do in MySQL

qa-featured

Hi Seth,

There is an equivalent SQL clause for LIMIT on FireBird. As far as I know the support start on FireBird 1.0.3. Using the FIRST keyword you can mimic the LIMIT clause in MySQL. There is also a keyword called SKIP to skip rows you don't want to show.

Here is a sample of how to do it:

SELECT FIRST 10 column1, column2, column3, column4 from TABLE1

To use SKIP with FIRST clause:

 

SELECT FIRST 10 SKIP 20 column1, column2, column3, column4 from TABLE1

Rows 21-30 will be displayed when the above query is executed.

 

I hope it helps.

 

Best Answer
Best Answer
Answered By 0 points N/A #104877

To make Limit clause as I typically do in MySQL

qa-featured

 

Hello Seth,

 

There is a  LIMIT clause in Firebird which is much similar to that of MySQL's LIMIT syntax.

This is very useful in situations where you bother  to run the database cursor over multiple requests and very useful when you want  the database to return back the most relevant result, over a large result set sometimes

This is working fine in Firebird 1.0.3.
 

  SELECT FIRST x [SKIP y] … [rest of query]

This syntax will return 'x' number rows of result from the query, and optionally skip first 'y' number of rows. 
 

Here is an example you might want to take a close look, it returns back row 21-30 from a query 

  SELECT FIRST 10 SKIP 20 column1, column2, column3 FROM foo
 

Recall the similar syntax or statement used in MySQL:

  SELECT column1, column2, column3 FROM foo LIMIT 10, 20


Hope you will get something out of this.

Login/Register to Answer

Related Questions