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;
- Having 子句
Impala中的Having子句允许您指定过滤哪些组结果显示在最终结果中的条件。
一般来说,Having子句与group by子句一起使用; 它将条件放置在由GROUP BY子句创建的组上。
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;
- 偏移量(offset) & 限制(limit)
OFFSET 需要使用order by 条件语句配合。
select * from table_test order by create_time limit 2 offset 1
网友评论