create table hody
(
  jm varchar(64) not null,
  Cim varchar(64) not null,
  Body int 
  );
  
 create table platy
(
  jmeno varchar(64) not null,
  Plat int 
  );
  
 insert into hody values('Vil','Ruka',4);
 insert into hody values('Tim','Noha',11);
 insert into hody values('Kid','Noha',7);
 insert into hody values('Zoe','Ruka',4);
 insert into hody values('Joe','Noha',15);
 insert into hody values('Cic','Noha',4);
 insert into hody values('Emi','Noha',3);
 insert into hody values('Sam','Noha',4);
 insert into hody values('Fif','Ruka',5);
 insert into hody values('Bob','Noha',11);
 insert into hody values('Grg','Ruka',5);
 insert into hody values('Lik','Ruka',4);
 insert into hody values('Han','Noha',11);
 
 
 insert into hody values('Bob', 60000);
 insert into hody values('Zuzi', 40000);
 insert into hody values('Jana', 30000);
 insert into hody values('Tere', 30000);
 insert into hody values('Adam', 20000);
 insert into hody values ('Bill', 20000);
 insert into hody values('Dan', 20000);
 insert into hody values('Pepa', 20000);
 insert into hody values('Hana', 10000);
 insert into hody values('Tom', 10000);
 
 
Select Jm, 
       Cim, 
       Body,
       Rank() Over (Partition By Cim Order By Body) Por
From Hody
Order By Cim, Body Desc;

Select Jm, 
           Cim, 
           Body,
           Row_number () 
                 Over (Partition By Cim Order By Body Desc) Jde
From Hody
Order By Cim, Jde;

Select Jm, 
           Cim, 
           Body,
           Dense_Rank () 
                 Over (Partition By Cim Order By Body Desc) Vuz
From Hody
Order By Cim, Vuz;

Select Jm, 
           Cim, 
           Body,
           Cume_Dist  () 
           Over (Partition By Cim Order By Body Desc) Odm
From Hody
Order By Cim, Body Desc;

Select Jm, 
           Cim, 
           Body,
           NTile (3) 
           Over (Partition By Cim Order By Body Desc) Vuz
From Hody
Order By Cim, Body Desc;

Select Jm, 
           Cim, 
           Body,
           4 - NTile (3) 
           Over (Partition By Cim Order By Body Desc) Vuz
From Hody
Order By Cim, Body Desc;

