熟悉經常使用的Hbase操做

1. 如下關係型數據庫中的表和數據,要求將其轉換爲適合於HBase存儲的表並插入數據:數據庫

學生表(Student)(不包括最後一列)spa

學號(S_No)code

姓名(S_Name)blog

性別(S_Sex)數學

年齡(S_Age)it

課程(course)table

2015001class

Zhangsan終端

maleim

23

 

2015003

Mary

female

22

 

2015003

Lisi

male

24

數學(Math)85

 

複製代碼
create 'Student', ' S_No  ','S_Name', ’S_Sex’,'S_Age'
put 'Student','s001','S_No','2015001'
put 'Student','s001','S_Name','Zhangsan'
put 'Student','s001','S_Sex','male'
put 'Student','s001','S_Age','23'
put 'Student','s002','S_No','2015003'
put 'Student','s002','S_Name','Mary'
put 'Student','s002','S_Sex','female'
put 'Student','s002','S_Age','22'
put 'Student','s003','S_No','2015003'
put 'Student','s003','S_Name','Lisi'
put 'Student','s003','S_Sex','male'
put 'Student','s003','S_Age','24'
複製代碼

列出HBase全部的表的相關信息;list

create 'Student','S_No','S_Name','S_Sex','S_Age'

在終端打印出學生表的全部記錄數據;

scan 'Student'

向學生表添加課程列族;

alter 'Student','NAME'=>'course'

向課程列族添加數學列並登記成績爲85;

put 'Student','s003','course:Math','85'

刪除課程列;

dorp 'Student','course'

統計表的行數;count 's1'

count 'Student'

清空指定的表的全部記錄數據;truncate 's1'

truncate 'Student'
相關文章
相關標籤/搜索