You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-31 18:30:33 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			753 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			753 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| USE tpch1;
 | |
| drop table if exists t;
 | |
| create table t(a bigint, b varchar(10)) engine=columnstore;
 | |
| insert into t values (1, 'hi');
 | |
| insert into t values (1, 'hello');
 | |
| insert into t values (2, 'bye');
 | |
| insert into t values (2, 'good night');
 | |
| select t.*, row_number() over (partition by a order by b) as rnum from t;
 | |
| a	b	rnum
 | |
| 1	hello	1
 | |
| 1	hi	2
 | |
| 2	bye	1
 | |
| 2	good night	2
 | |
| drop view if exists v;
 | |
| create view v as select * from t;
 | |
| select v.*, row_number() over (partition by a order by b) as rnum from v;
 | |
| a	b	rnum
 | |
| 1	hello	1
 | |
| 1	hi	2
 | |
| 2	bye	1
 | |
| 2	good night	2
 | |
| select v.*, min(a) over (partition by a order by b) as rnum from v;
 | |
| a	b	rnum
 | |
| 1	hello	1
 | |
| 1	hi	1
 | |
| 2	bye	2
 | |
| 2	good night	2
 | |
| select rank() over(order by a) from v;
 | |
| rank() over(order by a)
 | |
| 1
 | |
| 1
 | |
| 3
 | |
| 3
 | |
| drop table t;
 | |
| drop view v;
 |