Skip to content

Instantly share code, notes, and snippets.

@sygour
sygour / SQL Cheatsheet
Last active August 29, 2015 14:10
Useful SQL request
-- select the nth row of a table
-- from http://stackoverflow.com/questions/16568/how-to-select-the-nth-row-in-a-sql-database-table
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY key ASC) AS rownumber,
columns
FROM tablename
WHERE condition
) AS foo
WHERE rownumber = n