blob: c013fa6d8f5a9ac51191c6d6f4b7a042c0fbdd22 [file] [log] [blame]
buyingyic73348c2012-11-02 00:31:31 +00001drop table IF EXISTS supplier;
2drop table IF EXISTS result;
3
4create external table supplier (S_SUPPKEY INT, S_NAME STRING, S_ADDRESS STRING,
5S_NATIONKEY INT, S_PHONE STRING, S_ACCTBAL DOUBLE, S_COMMENT STRING) ROW FORMAT DELIMITED FIELDS TERMINATED
6BY '|' STORED AS TEXTFILE LOCATION '/tpch/supplier';
7
8create table result (S_SUPPKEY INT, S_NAME STRING, S_ADDRESS STRING, S_NATIONKEY INT);
9
10insert overwrite table result select s_suppkey, s_name, s_address, s_nationkey
11from supplier where S_SUPPKEY*2 < 20;
12
13select result.s_suppkey, supplier.s_phone, supplier.s_acctbal,
14supplier.s_comment from result join supplier on result.s_suppkey=supplier.s_suppkey;