演示了@AshishSingh答案刪除FIELDS TERMINATED BY "\t"
蜂巢
create table mytable (i int,j int,k int);
insert into mytable values (1,2,null),(null,5,null),(7,null,9);
select * from mytable
;
+-----------+-----------+-----------+
| mytable.i | mytable.j | mytable.k |
+-----------+-----------+-----------+
| 1 | 2 | NULL |
| NULL | 5 | NULL |
| 7 | NULL | 9 |
+-----------+-----------+-----------+
insert overwrite local directory "/tmp/mytable"
row format delimited fields terminated by "," null defined as ''
select * from mytable
;
慶典
cat /tmp/mytable/*
1,2,
,5,
7,,9
如何對其它列也可以爲空,寫爲「 – user4234323
@ user4234323檢查答案,我修改。 –