Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Select (SQL)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Other simple method (a little more efficient than read all rows) ==== # Select all the rows from the beginning of the table to the last row to display (<code>{begin_base_0 + rows}</code>) # Read the <code>{begin_base_0 + rows}</code> rows but send to display only when the row_number of the rows read is greater than <code>{begin_base_0}</code> {|class="wikitable" |- ! SQL ! Dialect |- | <syntaxhighlight lang="postgresql">select * from {table} order by {unique_key} FETCH FIRST {begin_base_0 + rows} ROWS ONLY</syntaxhighlight> | SQL ANSI 2008<br>PostgreSQL<br>SQL Server 2012<br>Derby<br>Oracle 12c<br>DB2 12<br>Mimer SQL |- | <syntaxhighlight lang="mysql">Select * from {table} order by {unique_key} LIMIT {begin_base_0 + rows}</syntaxhighlight> | MySQL<br>SQLite |- | <syntaxhighlight lang="tsql">Select TOP {begin_base_0 + rows} * from {table} order by {unique_key}</syntaxhighlight> | SQL Server 2005 |- | <syntaxhighlight lang="mysql">Select * from {table} order by {unique_key} ROWS LIMIT {begin_base_0 + rows}</syntaxhighlight> | Sybase, ASE 16 SP2 |- | <syntaxhighlight lang="tsql">SET ROWCOUNT {begin_base_0 + rows} Select * from {table} order by {unique_key} SET ROWCOUNT 0</syntaxhighlight> | Sybase, SQL Server 2000 |- | <syntaxhighlight lang="sql">Select * FROM ( SELECT * FROM {table} ORDER BY {unique_key} ) a where rownum <= {begin_base_0 + rows}</syntaxhighlight> | Oracle 11 |} <br>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)