Oracle Database 12c 行限制子句

Oracle Database 12c Row Limiting Clause

In Database 12c, to limit the number of rows in a query can be simplified by ANSI fetch first/offset keyword via Oracle SQL row limiting clause.
Database 12c裏,通過Oracle SQL 行限制子句來限制一個查詢的行數能夠用ANSI的 fetch first/offset 關鍵字簡化了.
For example, fetch the top 3 "oldest" employees:
例如,獲取"最老"的前3名員工
 select *
 from employees
 order by hire_date
 
fetch first 3 rowsonly;

And, keep the ties:
保持連結
 select *
 from employees
 order by hire_date
 fetch first 3 rows with ties
;

Or skip the first 3 employees, what we need is rank 4 to 6:
或者跳過前3名員工,我們需要的是排在第4到6的:
 select *
 from employees
 order by hire_date
 offset 3 rows
 fetch next 3 rows only
;

May be limiting row count is way too precise, percentage style is preferred sometime =)
或者限制行數這種方法太準確了,有時更偏向於百分數類型
 select * 
 from employees
 order by hire_date
 fetch first 10 percent rows only;

 Todd 

via Oracle Database 12c Row Limiting Clause

ps,英文水平一般,翻譯得不是很好.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章