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 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			595 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			595 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
| -- $Id: tpch18.sql 2657 2007-06-12 16:08:15Z rdempsey $
 | |
| -- TPC-H/TPC-R Large Volume Customer Query (Q18)
 | |
| -- Function Query Definition
 | |
| -- Approved February 1998
 | |
| 
 | |
| define 1 = 300
 | |
| 
 | |
| select
 | |
| 	c_name,
 | |
| 	c_custkey,
 | |
| 	o_orderkey,
 | |
| 	o_orderdate,
 | |
| 	o_totalprice,
 | |
| 	sum(l_quantity)
 | |
| from
 | |
| 	customer,
 | |
| 	orders,
 | |
| 	lineitem
 | |
| where
 | |
| 	o_orderkey in (
 | |
| 		select
 | |
| 			l_orderkey
 | |
| 		from
 | |
| 			lineitem
 | |
| 		group by
 | |
| 			l_orderkey having
 | |
| 				sum(l_quantity) > &1
 | |
| 	)
 | |
| 	and c_custkey = o_custkey
 | |
| 	and o_orderkey = l_orderkey
 | |
| group by
 | |
| 	c_name,
 | |
| 	c_custkey,
 | |
| 	o_orderkey,
 | |
| 	o_orderdate,
 | |
| 	o_totalprice
 | |
| order by
 | |
| 	o_totalprice desc,
 | |
| 	o_orderdate;
 | |
| 
 |