限制結果數量

ISO / ANSI SQL:

SELECT * FROM TableName FETCH FIRST 20 ROWS ONLY;

MySQL 的; PostgreSQL 的; SQLite 的:

SELECT * FROM TableName LIMIT 20; 

甲骨文:

SELECT Id,
   Col1
FROM (SELECT Id,
           Col1,
           row_number() over (order by Id) RowNumber
      FROM TableName)
WHERE RowNumber <= 20

SQL Server:

SELECT TOP 20 * 
FROM dbo.[Sale]