hbase
hbase客户端:dbvis-multi.exe
用db时不会写Hbase语句,有些语句怕自己忘记,记录在下面:
select * from "table" where "time"='201709'
select "aa",count("aa") from "table" group by "aa"
select * from "table" where "time" between '20170101' and '20171220'
select * from "table" where "time" >= '20171101' and "time" <= '20171220'
UPSERT INTO "table" ("pk", "nnnn") VALUES ('aaaa','hh');
select "content","time" from "table" where length("content")>=200
- 字段里含有“哈哈哈”、name在某个范围内的十个记录
select * from "table" where "content" like '%哈哈哈%' and "name" in ('zzz','yyy') limit 10
INSERT INTO table (a,b) VALUES (null, 1);
update "table" set "type" = '7' where "type" = 'h'
select "aa" from "table" order by "aa" desc
create table a_copy like a
insert into a_copy select * from a
delete from a_copy where class = 'hhh'
- 做实验时需要临时从其他表里导入数据造一张新表,可以这样:
hbase shell
truncate "table1"
upsert into "table1" select * from "table2" limit 100
sql sever
drop TABLE 哈哈哈
mysql
select * from table where to_char(sysdate,'yyyy-mm')=to_char(hh,'yyyy-mm')
select * from table where to_char(hh,'yyyy')=2016 and to_char(hh,'mm') in (1,2,3)
select * from table where yearNo=2017 order by updateTime desc
spark的dataframe写入mysql时,比如df有3列(q,w,e),但mysql表有四列(q,w,e,r),我们只要给mysql的表字段设置默认值就行了,如Null.–我自己的话。