Impala的简单使用

2018-09-10  本文已影响0人  ggr
create table if not exists touch.table_test(
  name string comment '姓名',
  age int not null comment '年龄',
  sex tinyint not null comment '性别',
  create_time timestamp not null comment '创建时间',
  primary key(name) 
  ) partition  by hash(name) partitions  10 
stored as kudu
describe table_test
ALTER TABLE table_test CHANGE name user_name String
ALTER TABLE table_test ADD COLUMNS( update_time timestamp)
ALTER TABLE table_test ADD COLUMNS( email string,phone string)
ALTER TABLE table_test drop sex
insert into table_test values('ggr',23,now(),now(),'3095764372@qq.com','17895642365');
insert overwrite table_test values('ggr',24,now(),now(),'3095764372@qq.com','17895642365');
//2.8版本之后
UPSERT INTO kudu_table (pk, c1, c2, c3) VALUES (0, 'hello', 50, true), (1, 'world', -1, false);

UPSERT INTO production_table SELECT * FROM staging_table;
 | Impala SQL Language Reference | 418
UPSERT INTO production_table SELECT * FROM staging_table WHERE c1 IS NOT
 NULL AND c2 > 0;

SELECT * FROM table_test;
SELECT user_name,age FROM table_test;   
Create View IF NOT EXISTS view_name as Select statement
DROP VIEW database_name.view_name;
ALTER VIEW database_name.view_name为Select语句
select * from table_name ORDER BY col_name [ASC|DESC] [NULLS FIRST|NULLS LAST]
select data from table_name Group BY col_name;
select * from table_name ORDER BY col_name [ASC|DESC] [NULLS FIRST|NULLS LAST]
select distinct columns… from table_name;
select * from customers order by id limit 3
 union select * from employee order by id limit 3;
select * from table_test order by create_time limit 2 offset 1
上一篇下一篇

猜你喜欢

热点阅读