--------------------------- 建表 ---------------------------
create table test_user
(
id VARCHAR2(12),
name VARCHAR2(32),
age number(2)
)
select t.id,t.name,t.age from test_user t
insert into test_user (ID, NAME,age)
values ('1', '张三',12);
insert into test_user (ID, NAME,age)
values ('2', '李四',12);
insert into test_user (ID, NAME,age)
values ('3', '王五',12);
insert into test_user (ID, NAME,age)
values ('4', '赵六',21);
insert into test_user (ID, NAME,age)
values ('5', '田七',21);
--------------------------- 建表 ---------------------------
select t.*, t.rowid from test_user t order by id
select id,name,age, row_number() over(partition by age order by id desc ) from test_user;
partition by 是用来分组的,用了这个就可以实现在组内进行排序
order by是用来确定排序的基准的,按照那一列来排序