load data local inpath overwrite into table student;


关键字local表明数据从local disk中读取, 如果没有此关键字, 则数据从hdfs中读取。


关键字keyword表明 先删除表中的数据,然后再插入数据。 如果没有这个关键字, 则表明是append的方式。


Note:

    1. load不会检验要load的data是否符合shema。

    2. If the file is in hdfs, it is moved into the Hive-controlled file system namespace.
The root of the Hive directory is specified by the option hive.metastore.warehouse.dir in hive-default.xml. We advise users to create this directory before trying to create tables via Hive.


Group by

hive> FROM invites a INSERT OVERWRITE TABLE events SELECT a.bar, count(*) WHERE a.foo > 0 GROUP BY a.bar;
hive> INSERT OVERWRITE TABLE events SELECT a.bar, count(*) FROM invites a WHERE a.foo > 0 GROUP BY a.bar;
还是习惯第二种写法啦。