You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-30 07:25:34 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			673 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			673 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
| -- $Id: tpch11.sql 2657 2007-06-12 16:08:15Z rdempsey $
 | |
| -- TPC-H/TPC-R Important Stock Identification Query (Q11)
 | |
| -- Functional Query Definition
 | |
| -- Approved February 1998
 | |
| 
 | |
| define 1 = GERMANY
 | |
| define 2 = 0.0001
 | |
| 
 | |
| select
 | |
| 	ps_partkey,
 | |
| 	sum(ps_supplycost * ps_availqty) as value
 | |
| from
 | |
| 	partsupp,
 | |
| 	supplier,
 | |
| 	nation
 | |
| where
 | |
| 	ps_suppkey = s_suppkey
 | |
| 	and s_nationkey = n_nationkey
 | |
| 	and n_name = '&1'
 | |
| group by
 | |
| 	ps_partkey having
 | |
| 		sum(ps_supplycost * ps_availqty) > (
 | |
| 			select
 | |
| 				sum(ps_supplycost * ps_availqty) * &2
 | |
| 			from
 | |
| 				partsupp,
 | |
| 				supplier,
 | |
| 				nation
 | |
| 			where
 | |
| 				ps_suppkey = s_suppkey
 | |
| 				and s_nationkey = n_nationkey
 | |
| 				and n_name = '&1'
 | |
| 		)
 | |
| order by
 | |
| 	value desc;
 | |
| 
 |