github.com/matrixorigin/matrixone@v0.7.0/pkg/sql/plan/tpch/q2.sql (about)

     1  select
     2  	s_acctbal,
     3  	s_name,
     4  	n_name,
     5  	p_partkey,
     6  	p_mfgr,
     7  	s_address,
     8  	s_phone,
     9  	s_comment
    10  from
    11  	part,
    12  	supplier,
    13  	partsupp,
    14  	nation,
    15  	region
    16  where
    17  	p_partkey = ps_partkey
    18  	and s_suppkey = ps_suppkey
    19  	and p_size = 48
    20  	and p_type like '%TIN'
    21  	and s_nationkey = n_nationkey
    22  	and n_regionkey = r_regionkey
    23  	and r_name = 'MIDDLE EAST'
    24  	and ps_supplycost = (
    25  		select
    26  			min(ps_supplycost)
    27  		from
    28  			partsupp,
    29  			supplier,
    30  			nation,
    31  			region
    32  		where
    33  			p_partkey = ps_partkey
    34  			and s_suppkey = ps_suppkey
    35  			and s_nationkey = n_nationkey
    36  			and n_regionkey = r_regionkey
    37  			and r_name = 'MIDDLE EAST'
    38  	)
    39  order by
    40  	s_acctbal desc,
    41  	n_name,
    42  	s_name,
    43  	p_partkey
    44  limit 100
    45  ;