Eine Einführung in
SQL
Get the 11th to the 20th rows of the cia table - by population.
SQLite
SELECT name, population FROM cia ORDER BY population DESC LIMIT 10 OFFSET 10
Specific to SQLite
none
DB2
Specific to DB2
none
MS Access
SELECT TOP 10 x.name, x.population FROM ( SELECT TOP 20 name, population FROM cia ORDER BY population DESC) x ORDER BY x.population ASC
Specific to MS Access
none
PostgreSQL
SELECT name, population FROM cia ORDER BY population DESC LIMIT 10 OFFSET 10
Specific to PostgreSQL
none
Oracle
SELECT name, population FROM ( SELECT name, population, rownum n FROM ( SELECT name,population FROM cia ORDER BY population DESC) ) WHERE n BETWEEN 11 AND 20
Specific to Oracle
This seems very complicated, seemingly the rownum is calculated after the WHERE clause runs so WHERE rownum>1 always gives zero rows.
MS SQL Server
SELECT TOP 10 x.name, x.population FROM ( SELECT TOP 20 name, population FROM cia ORDER BY population DESC) x ORDER BY x.population ASC
Specific to MS SQL Server
We select the bottom 10 of the top 20 - we end up with the list in the wrong order - this can be fixed with another nested select.
MySQL
SELECT * FROM cia ORDER BY population DESC LIMIT 11, 10
Specific to MySQL
none
Sybase
Specific to Sybase
none
Mimer SQL
Specific to Mimer SQL
none