您的位置:首页 > 数据库

hbase sql 基本命令模板

2016-02-24 05:49 381 查看
--create table

       member is  table name

       member_id , address , info    are   column family

create 'member','member_id','address,''info'

--delete column family

         disable 'member'

         alter 'member',{NAME='address','METHOD=''delete'}

         enable 'member'

--DML

====insert

              put 'member','wo','address:age' ,'26'

====update

             put 'member','wo','address:age' ,'27'

--query

====select

              get 'member','wo','address:age'

====select historical   'address:age' ,'26'

              get 'member','wo',{COLUMN=>'address:age', TIMESTAMP=>$timestampe value of historical data}

--others:

====desc table

              describe  'member'

====all table scan

               scan 'member'

               ROW                  COLUMN+CELL                                               

              shabi               column=address:age, timestamp=1456263402795, value=26     

              shabi               column=info:age, timestamp=1456263628325, value=27        

              shabi               column=info:detials, timestamp=1456263201562, value=s25

--how to process index?

              select  indexed_column  from  table     =>      set indexed_column  as key in HBAse

              select .... from table 1 table2 where table1.column = table2.column  and a=?      =>   set  a as key of table1     set  table1.column as key of table2

             select .... from table 1 where a=? and b=?   =>    set (a,b) as an union key
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: