实验三 HBase分布式数据库操作与编程

1、HBase Shell数据库表创建

【实验内容】
根据以下关系型数据库表,使用HBase Shell设计并创建适宜的HBase数据表。

2、创建表以及插入学生信息数据

(1)、启动Hadoop

(2)、启动HBase

(3)、进入shell界面

(4)、创建表

(5)、插入数据(我是采用的学生的学号作为RowKey即行键,因此插入数据时不必在插入学生编号,同时课程建了三个列族,用于存储同一行键下的不同课程)
①新增学号为2015001的学生的所有信息

put 'StudentAndCourse','2015001','student:S_Name','Zhangsan'
put 'StudentAndCourse','2015001','student:S_Sex','male'
put 'StudentAndCourse','2015001','student:S_Age','23'
put 'StudentAndCourse','2015001','course1:C_No','123001'
put 'StudentAndCourse','2015001','course1:C_Name','Math'
put 'StudentAndCourse','2015001','course1:C_Credit','2.0'
put 'StudentAndCourse','2015001','course1:Score','86'
put 'StudentAndCourse' ,'2015001','course3:C_No','123003'
put 'StudentAndCourse' ,'2015001','course3:C_Name','English'
put 'StudentAndCourse' ,'2015001','course3:C_Credit','3.0'
put 'StudentAndCourse' ,'2015001','course3:Score','69'

②、新增学号为2015002的学生的所有信息

put 'StudentAndCourse' ,'2015002','student:S_Name','Mary'
put 'StudentAndCourse' ,'2015002','student:S_Sex','female'
put 'StudentAndCourse' ,'2015002','student:S_Age','22'
put 'StudentAndCourse' ,'2015002','course2:C_No','123002'
put 'StudentAndCourse' ,'2015002','course2:C_Name','Conputer Science'
put 'StudentAndCourse' ,'2015002','course2:Credit','5.0'
put "StudentAndCourse" ,'2015002','course2:Score','77'
put 'StudentAndCourse' ,'2015002','course3:C_No','123003'
put 'StudentAndCourse' ,'2015002','course3:C_Name','English'
put 'StudentAndCourse' ,'2015002','course3:Credit','3.0'
put 'StudentAndCourse' ,'2015002','course3:Score','99'

③、新增学号为2015003的学生的所有信息

put 'StudentAndCourse' ,'2015003','student:S_Name','Lisi'
put 'StudentAndCourse' ,'2015003','student:S_Sex','male'
put 'StudentAndCourse' ,'2015003','student:S_Age','24'
put 'StudentAndCourse' ,'2015003','course1:C_No','123001'
put 'StudentAndCourse' ,'2015003','course1:C_Name','Math'
put 'StudentAndCourse' ,'2015003','course1:C_Credit','2.0'
put 'StudentAndCourse' ,'2015003','course1:Score','98'
put 'StudentAndCourse' ,'2015003','course2:C_No','123002'
put 'StudentAndCourse' ,'2015003','course2:C_Name','Computer Science'
put 'StudentAndCourse' ,'2015003','course2:C_Credit','5.0'
put 'StudentAndCourse' ,'2015003','course2:Score','95'

3、查看表的数据

①、新增学号2015001的学生信息过后表的数据

②、新增学号为2015002的学生信息过后表的数据

③、学生信息全都新增过后表的数据

总的来说,在shell命令中插入数据还挺麻烦的,每次只能添加表的一行数据的一个列,也就是一个单元格的数据,如果向这种数据比较多的话,插入数据是比较费时间的。还有一个问题就是如果创建表的时候,对于课程不创建三个列族,而是创建一个列族的话,那么对于同一行键的不同选课,就比如Zhangsan选有课程Math与English,如何将Math与English存储在同一个列族下呢?

HBase数据库表的创建相关推荐

  1. 合理设计及优化HBase数据库表入门

    在完成创建HBase数据库后我们后续最重要的工作就是如何设计和构建出合理高效的hbase表.那么接下来本文就将介绍一下如何设计及优化HBase数据库的表.OK,废话不再多说,接下来我们进入今天的正题~ ...

  2. java实现遍历树形菜单方法——数据库表的创建

    这里主要是oracle数据库表的创建: --创建树形菜单表 create table vote_tree (id number(10) not null,text varchar2(30) not n ...

  3. 数据库创建(利用写好的数据库表生成创建表的sql语句+利用生成的数据库创建表加同步数据sql)

    一.利用写好的数据库表生成创建表的sql语句 1.简单创建一个数据库,并建一个表,并编辑数据. a.建库 b.建表 c.编辑表,保存时输入表名 d.刷新一下,出来了 e.转存导出sql文件. 二.利用 ...

  4. mysql数据库表的创建与查看

    mysql数据库表的创建与查看 一.mysql查看 查看所有数据库 show databases 切换数据库 use 数据库名 查看该数据库下所有的表名 show tables 查看表的结构 desc ...

  5. 实验1 在MySQL创建数据库及表_数据库表的创建、管理和数据操作(实验一),数据库创建...

    数据库表的创建.管理和数据操作(实验一),数据库创建 今天我们就以实验的形式对表的创建.管理和数据操作进行学习,上课吧. [实验目的]:了解SQL语言的使用,进一步理解关系运算,巩固数据库的基础知识. ...

  6. oracle数据库导入表空间,oracle数据库表空间创建导入导出

    1.表空间创建 --删除表空间 drop tablespace EVPBDMGIS including contents and datafiles; --删除用户 drop user EVPBDMG ...

  7. thinkphp更新mysql数据库表_ThinkPHP 创建新表、创建数据库讲解

    很多时候我们想通过ThinkPHP 创建新表,或者创建数据库,很多时候我们往往把事情想得复杂了,其实我们太依赖于框架以至于忘了最原始的东西--通过最原始的PHP来创建新表是完全可以的. 通过PHP/T ...

  8. excel查询mysql数据库表,excel创建数据表/查询mysql数据库中所有表名

    excel两个表格,数据库表与专门查询该数据库信息的表.在查询表中以多个项目进行查询符合条件的数据. 可以用"筛选"这个功能,在菜单里,对两个列进行筛选,符合条件的就会显示出来.很 ...

  9. 达梦数据库表空间创建

    安装 最简单的用docker安装 https://eco.dameng.com/docs/zh-cn/start/dm-install-docker.html 安装完成后进入容器执行disql命令 默 ...

最新文章

  1. win10 搭载文件服务器,win10远程文件服务器
  2. Java程序员从笨鸟到菜鸟之(二十八)Javascript总结之语言基础
  3. 《每日一题》62. Unique Paths 不同路径
  4. sh: react-scripts: command not found after running npm start
  5. Socket的3次握手链接与4次断开握手
  6. Arraylist线程不安全原因
  7. 渐进式加载 - 基础讲解
  8. PreparedStatement的用法
  9. 中兴捧月算法-切绳子
  10. 学会一招!如何利用 pandas 批量合并 Excel?
  11. C# datagridview CheckBox勾选问题
  12. 宏观经济及贵金属年报:经济温和复苏,金银宽幅震荡-20210104.PDF
  13. BZOJ 1050: [HAOI2006]旅行comf
  14. Altium Designer系列:问题之无法打开pcb文件
  15. 解决MATLAB2018b打开m文件后注释乱码的问题
  16. 在MatLab中FFT和IFFT的互相转换
  17. 自签名SSL证书的安全隐患和风险
  18. Autoencoder-based Zeroth Order Optimization Method for Attacking Black-box Neural Networks
  19. RK3399平台开发系列讲解(网络调试)7.33、网络性能优化
  20. python之LIST、Tuple、Dictionary用法总结

热门文章

  1. 怎么选择好的CCD视觉检测?
  2. 数据库系列-什么是 JDBC?它的作用是什么?
  3. 视频捕获:预览、截图、录像(MP4 软/硬编码)、推流,一网打尽
  4. Bitmiracle Docotic.Pdf Library 8.8.14015 Crack
  5. 主流webservice框架整理
  6. Android 文件下载,根据url获取真正的文件名和后缀名(包括重定向的url)
  7. 当前端要做地区显示,而后端传给你的只有地区编码
  8. NC UAP STUDIO授权
  9. 奶牛跟蜗牛,哪种动物智商更高?——T检验帮你找到答案
  10. 十次方需求分析与技术架构、Node.js、包资源管理器NPM、Webpack