Sunday, May 14, 2023

How to use SQL pagination using LIMIT and OFFSET

 How to extract just a portion of a larger result set from a SQL SELECT.


LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY.

The OFFSET clause specifies the number of rows of the result table to skip before any rows are retrieved,
and must be used with the LIMIT clause.


The OFFSET clause instructs the server where to start returning rows within the query result.
For example, if a query returns 100 rows, specifying OFFSET 10 instructs the server to skip
the first 10 rows of the query results:

Tuesday, May 9, 2023

Why do we need SQL functions when stored procedures can do all what SQL function does?


A function can be used inline in SQL statements while stored procedures cannot.

you cannot call a stored procedure in a SELECT statement. I guess this could be a reason for using functions.





How to use SQL pagination using LIMIT and OFFSET

  How to extract just a portion of a larger result set from a SQL SELECT. LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY. T...