Create HBase Table Usage & Syntax

CREATE statement is used to create a HBase table, in this section, I will explain how to create an HBase table from the shell, syntax, usage, and practice with some examples.

HBase stores rows in the tables and each table is split into ‘regions’. Those regions are distributed across the cluster, hosted and made available to client processes by the RegionServer process in the system. All rows in the tables are sorted between regions start and end key. Every single row is belonging to exactly one region and a region is served by a single region server at any given point of time

HBase Create Table from Shell

Use CREATE command to create a HBase table, It takes name and column family as mandatory arguments. The syntax to create the table is as follows.

Create Table Syntax

CREATE 'name_space:table_name', 'column_family' 

Note that namespace for table name is optional and when not specified it creates a table in the default namespace. column_family is mandatory, at least one column family needed in order to create a table successfully. when not specified, it returns an error.

Create Table Examples

Below example creates an ’emp’ table in default namespace and sets the column family as ‘office’. Make sure you create a namespace before using with the table.

hbase create table command

When trying to create a table with an already existing name regardless of column family (with the same or different column family), you will get the bellow error message.

hbase create table command

HBase Tables in a namespace should be unique.

HBase Split Table

As explained in the beginning, HBase tables are split and stores date into several regions. When the table is created, by default, HBase allocates a single region to it. Let’s see an example of how to split the table to multiple regions and use the cluster effectively.

HBase Split Table Syntax

CREATE 'name_space:table_name', 'column_family'  SPLITS => ['10', '20', '30', '40']

Below example creates a new table dep

create table command with splits

Refer Internals of HBase table splitting for understanding how splitting works.

Use list to list all the tables. This is similar to show tables in Hive

create table statement

Besides these above examples, there are multiple options you can use while creating a table. I will leave these to you to explore.

Let’s insert some data using Put command, refer to the link for more detail examples.

hbase(main):060:0> put ’emp’, ‘1’ , ‘office:name’, ‘Scott’ hbase(main):060:0> put ’emp’, ‘2’ , ‘office:name’, ‘Mark’ hbase(main):061:0> put ’emp’, ‘2’ , ‘office:gender’, ‘M’ hbase(main):062:0> put ’emp’, ‘2’ , ‘office:age’, ’30’ hbase(main):063:0> put ’emp’, ‘2’ , ‘office:age’, ’50

Finally use the Scan command to fetch the data from a table.


In this tutorial, you have learned how to create an HBase table from shell command and also have seen an example of how to split the table into regions.

You May Also Like

Happy Learning !!

NNK is a Big Data and Spark examples community page, all examples are simple and easy to understand and well tested in our development environment Read more ..

Leave a Reply