SQL Server:
select * from table except select top N * from table
Oracle up to 11.2:
select * from table minus select * from table where rownum <= N with TableWithNum as ( select t.*, rownum as Num from Table t ) select * from TableWithNum where Num > N
Oracle 12.1 and later (ANSI SQL compliant)
select * from table order by some_column offset x rows fetch first y rows only
They can satisfy your needs more or less.
There is no direct way to do what you want using SQL. However, in my opinion, this is not a design flaw.
SQL should not be used this way.
In relational databases, a table represents a relationship that is defined by definition. The set contains unordered elements.
Also, do not rely on the physical order of entries . The row order is not guaranteed by the DBMS.
If the order of the entries is important, you'd better add a column such as "Num" to the table and use the following query. This is more natural.
select * from Table where Num > N order by Num
ju
source share