CREATE TABLE `customer` (
  `c_nationkey` int(11) DEFAULT NULL,
  KEY `i_c_nationkey` (`c_nationkey`)
) ENGINE=MyISAM;
 
INSERT INTO `customer` VALUES (18),(17),(8);
 
CREATE TABLE `lineitem` (
  `l_orderkey` int(11) NOT NULL DEFAULT 0,
  `l_partkey` int(11) DEFAULT NULL,
  `l_linenumber` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`l_orderkey`,`l_linenumber`)
) ENGINE=MyISAM;
 
INSERT INTO `lineitem` VALUES (1,1,1),(1,1,4),(3,1,1);
 
CREATE TABLE `nation` (
  `n_nationkey` int(11) NOT NULL,
  `n_regionkey` int(11) DEFAULT NULL,
  PRIMARY KEY (`n_nationkey`),
  KEY `i_n_regionkey` (`n_regionkey`)
) ENGINE=MyISAM;
 
INSERT INTO `nation` VALUES (17,1),(24,1);
 
CREATE TABLE `orders` (
  `o_orderkey` int(11) NOT NULL,
  `o_totalprice` double DEFAULT NULL,
  PRIMARY KEY (`o_orderkey`)
) ENGINE=MyISAM;
 
INSERT INTO `orders` VALUES
(1,125405.67),(2,36349.29),(3,150931.2),(4,28568.05),(5,80601.73);
 
CREATE TABLE `partsupp` (
  `ps_partkey` int(11) NOT NULL DEFAULT 0,
  `ps_suppkey` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`ps_partkey`,`ps_suppkey`)
) ENGINE=MyISAM;
 
INSERT INTO `partsupp` VALUES (1,1),(17,1);
 
CREATE TABLE `region` (
  `r_regionkey` int(11) NOT NULL,
  PRIMARY KEY (`r_regionkey`)
) ENGINE=MyISAM;
 
INSERT INTO `region` VALUES (0),(1),(2),(3),(4);
 
CREATE TABLE `supplier` (
  `s_suppkey` int(11) NOT NULL,
  `s_nationkey` int(11) DEFAULT NULL,
  `s_acctbal` double DEFAULT NULL,
  PRIMARY KEY (`s_suppkey`)
) ENGINE=MyISAM;
 
INSERT INTO `supplier` VALUES (1,17,5755.94);
 
SELECT n_nationkey FROM nation LEFT JOIN region ON ( r_regionkey = n_regionkey ) JOIN supplier ON ( s_nationkey = n_nationkey ) JOIN partsupp ON ( s_suppkey = ps_suppkey ) JOIN lineitem ON ( ps_partkey = l_partkey ) JOIN orders ON ( l_orderkey = o_orderkey ) JOIN customer WHERE o_totalprice = 151 OR c_nationkey = s_nationkey AND s_acctbal > 187;
 
CREATE TABLE t (a INT);
INSERT INTO t VALUES (1),(17),(2),(17);


