12C SQL-TOP
在剛才的基礎上。
insert into look values (2,'a',100);
insert into look values (3,'a',100);
insert into look values (4,'a',100);
insert into look values (5,'a',100);
insert into look values (6,'a',100);
insert into look values (7,'a',100);
insert into look values (8,'a',100);
insert into look values (9,'a',100);
insert into look values (10,'a',100);
insert into look values (11,'a',100);
insert into look values (12,'a',100);
insert into look values (13,'a',100);
insert into look values (14,'a',100);
insert into look values (15,'a',100);
insert into look values (16,'a',100);
insert into look values (17,'a',100);
insert into look values (18,'a',100);
insert into look values (19,'a',100);
insert into look values (20,'a',100);
SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;
SQL> SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
20 a 100
19 a 100
18 a 100
排名前三的
SQL> SELECT * FROM look ORDER BY id DESC FETCH FIRST 10 PERCENT ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
20 a 100
19 a 100
排名前10%的
SQL> SELECT * FROM look ORDER BY id DESC OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
15 a 100
14 a 100
13 a 100
12 a 100
11 a 100
忽略前5條記錄並會顯示錶的下5條記錄:
SELECT * FROM look ORDER BY id FETCH FIRST 5 PERCENT ROWS WITH TIES;
ID NAME MONEY
---------- ---------- ----------
1 a 100
insert into look values (2,'a',100);
insert into look values (3,'a',100);
insert into look values (4,'a',100);
insert into look values (5,'a',100);
insert into look values (6,'a',100);
insert into look values (7,'a',100);
insert into look values (8,'a',100);
insert into look values (9,'a',100);
insert into look values (10,'a',100);
insert into look values (11,'a',100);
insert into look values (12,'a',100);
insert into look values (13,'a',100);
insert into look values (14,'a',100);
insert into look values (15,'a',100);
insert into look values (16,'a',100);
insert into look values (17,'a',100);
insert into look values (18,'a',100);
insert into look values (19,'a',100);
insert into look values (20,'a',100);
SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;
SQL> SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
20 a 100
19 a 100
18 a 100
排名前三的
SQL> SELECT * FROM look ORDER BY id DESC FETCH FIRST 10 PERCENT ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
20 a 100
19 a 100
排名前10%的
SQL> SELECT * FROM look ORDER BY id DESC OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY;
ID NAME MONEY
---------- ---------- ----------
15 a 100
14 a 100
13 a 100
12 a 100
11 a 100
忽略前5條記錄並會顯示錶的下5條記錄:
SELECT * FROM look ORDER BY id FETCH FIRST 5 PERCENT ROWS WITH TIES;
ID NAME MONEY
---------- ---------- ----------
1 a 100
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/637517/viewspace-2147547/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【12c Partitioning】Oracle 12c Partitioning特性Oracle
- Oracle 12cOracle
- Oracle 12C GDSOracle
- 12c安裝
- 12c多租戶架構下部署GoldenGate 12c架構Go
- Oracle 12c系列(十) | 12c中的Recovering Tables and Table PartitionsOracle
- 【OCM】Oracle 12C OCMU 12c OCM升級考試大綱Oracle
- goldengate 12c 針對oracle 12c配置的主要變化GoOracle
- Oracle 12c與GoldenGate 12c的一些問答OracleGo
- Oracle 12C安裝Oracle
- 12c pdb基本操作
- Oracle 12c新特性Oracle
- Oracle 12c Relocate PDBOracle
- Oracle 12c Refreshable CloneOracle
- Oracle 12c RAC: MGMTDBOracle
- ORACLE 12C EM ExpressOracleExpress
- Oracle 12C配置EMOracle
- ORACLE 12c Core DocOracle
- 12c in-database archiveDatabaseHive
- 12c EM Database ExpressDatabaseExpress
- 12c em安裝
- Oracle 12c - Data RedactionOracle
- oracle 12c 釋出Oracle
- 12c new feature
- 【12c】12c RMAN新特性之recover table(表級別恢復)
- 【12C】Oracle 12C 新特性“可插拔資料庫”功能體驗Oracle資料庫
- Oracle 12c升級指南Oracle
- 12C Oracle ASM Filter DriverOracleASMFilter
- Oracle 12c Automatic ReoptimizationOracle
- benchmark 壓測Oracle 12cOracle
- sysbench壓測Oracle 12COracle
- OGG 12c MySQL to MySQLMySql
- 當12C PDB遇上JDBCJDBC
- 12c ASM中建立ACFSASM
- oracle 12c Deprecation of Oracle StreamsOracle
- Oracle 12c 新特性(四)Oracle
- Oracle 12c 新特性(三)Oracle
- Oracle 12c 新特性(二)Oracle