createtable test(
man struct<name:string,agt:int>comment"个人信息",marry_info map<string,string>comment"婚姻信息",hobby array<string>comment"爱好");-- 插入数据insertinto test
select name_struct("name","小明","age",12),str_to_map("小明:单身,时长:3年"),array("打球,游泳,滑雪")--查询数据select
a.man.name
,a.marry_info["小明"],a.hobby[0]from
test a
建表
createtable test(
id intcomment"序号",start_time timestampcomment"开始时间",name string comment"姓名")comment"小小牛学院信息"
插入
-- 部分字段插入insertinto test(id,name)select33882,"刚子"-- 全字段插入insertinto test
select33882,current_timestamp(),"刚子"
查询
select*from test a where a.id=33882
删除
-- 覆盖重写insert overwrite table test
select*from test a where a.id=33