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