403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/mysql/mysql-test/main/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/mysql/mysql-test/main/win_rank.test
--echo #
--echo # Try DENSE_RANK() function
--echo #

create table t1 (
  pk int primary key,
  a int,
  b int
);

insert into t1 values
( 1 , 0, 10),
( 2 , 0, 10),
( 3 , 1, 10),
( 4 , 1, 10),
( 8 , 2, 10),
( 5 , 2, 20),
( 6 , 2, 20),
( 7 , 2, 20),
( 9 , 4, 20),
(10 , 4, 20);

select a, rank() over (order by a) as rank,
          dense_rank() over (order by a) as dense_rank
from t1;
select a, b, rank() over (partition by b order by a) as rank,
             dense_rank() over (partition by b order by a) as dense_rank
from t1;

drop table t1;

--echo #
--echo # Test with null values in the table.
--echo #

create table t2 (s1 int, s2 char(5));
insert into t2 values (1,'a');
insert into t2 values (null,null);
insert into t2 values (1,null);
insert into t2 values (null,'a');
insert into t2 values (null,'c');
insert into t2 values (2,'b');
insert into t2 values (-1,'');

select *, rank() over (order by s1) as rank,
          dense_rank() over (order by s1) as dense_rank
from t2
order by s1, s2;
select *, rank() over (partition by s2 order by s1) as rank,
          dense_rank() over (partition by s2 order by s1) as dense_rank
from t2
order by s1, s2;
select *, rank() over (order by s2) as rank,
          dense_rank() over (order by s2) as dense_rank
from t2
order by s2, s1;
select *, rank() over (partition by s1 order by s2) as rank,
          dense_rank() over (partition by s1 order by s2) as dense_rank
from t2;

drop table t2;

Youez - 2016 - github.com/yon3zu
LinuXploit