Table Creation & Data insertion
368 views
Oct 24, 2024
Table Creation & Data insertion Watch more Videos at https://www.tutorialspoint.com/videotutorials/index.htm Lecture By: Mr. Arnab Chakraborty, Tutorials Point India Private Limited
View Video Transcript
0:00
In this video we are discussing edge-based table creation and data insertion
0:06
How to create a table and how to insert records on it
0:10
How to create table in edge-base? We can create a table using the create command
0:15
So, create command is there with the help of which you can create a table, but obviously
0:20
we are supposed to pass some other parameters. And here you must specify the table name and the column family name
0:27
will be like this, create table name and column family and comma will be there as a separated
0:34
So let us go for one example. So to create a student table with the personal data and college data column family
0:41
So I am having two column families. One is the personal data and another one is the college data and the table name will be student
0:48
The syntax will be something like this. So create student comma personal underscore data, comma, personal underscore data, comma
0:57
college underscore data. So, using this particular command, create, we can create a table
1:03
The table name will be student and two column families as we have mentioned
1:08
Note that start Hadoop at first to run all these comments. So, Hadoop should get started at first
1:14
Then you should issue such comments. Now we shall discuss how to insert data into table in HBEST
1:22
So here the command will be put. So using put command, we can insert roles on
1:27
onto our table. So, syntax will be put table name, comma, row name, comma, column family, colon column name
1:36
and then the value. So in this way, we can go for that. So let us insert one row
1:42
The row number will be one to the student table. And here we are supposed to use this particular comment like this
1:49
Put here the table name is student, row num is one, personal data, personal underscore data is
1:56
the column family name colon name is a column and then obishek is the respective value so let us go
2:03
for one practical demonstration for the easy understanding of this concept at first we shall
2:09
start hadup so control alter t to initiate one new terminal here so to start hadoop we should
2:19
type dollar hadup underscore install all in capital letters slash sbin slash start hyphen all dot sh so this is a shell program
2:36
which are which is supposed to get executed to start hadup on our system now to check
2:46
whether how doop is executing properly or not we are executing the command jps and you can find
2:52
that node manager name node resource manager secondary name node and data node all the
2:59
processes are executing now we shall initiate our GUA interface of Hadoop so we are
3:07
opening our browser in the URL we are typing local host local host colon 5 0070 slash You see the name node related information is coming here
3:25
All the name node related information they are coming. So Hadoop is operating fine
3:32
You can go for utilities, you can go for browse the file system
3:36
and all the default folders and the files are coming here. So that indicates that my Hadoop is executing
3:42
is executing perfectly it has got loaded and initiated into the memory now we
3:49
shall start edge base so how to start edge base so let us open one new
3:53
terminal that is the alt control and t so a new terminal will be opened here
4:00
so all control and t will be the combination so at first we shall execute one
4:05
shell program that is a start edge base dot sh and then we shall go for JPS to check what are the new processes have started
4:24
you can find that before executing this start hbass.s.h I had these processes. So now
4:33
we can find that we're having extra processes like your H master. We're having H region
4:39
server and also we're having the respective H-coram peer. So these are the three new processes, H-master, H-region server, and H-coram-peer
4:53
So there are three separate processes have got initiated when we initiate our age-base
4:59
So now let us go for this and then to bring the H-base shell, we shall go for H-base shell
5:12
In this way the edge base shell will be coming here. Actually you see the shell is getting initiated and this is the prompt we have got
5:23
And edge base contains a shell using which we can communicate with the edge base
5:29
And edge base uses the Hado file system to store its data and it will have a master server
5:36
and a region server for this operation. The data storage will be in the form of region
5:42
that is known as the tables and these regions will be split up and stored in the region
5:49
servers the master server manages these region servers and all these tasks take place
5:57
on sdf sd so let us go for some commands which will be supported by this hbase shell
6:04
so that was we're going for the status so this status command provides the status of hbase
6:11
and for example the number of servers and so on next we can issue the command
6:17
there is a version so this version provides the version of the edge base being
6:22
used in our system let us go for this table help table underscore help so this
6:30
provides a help for table reference commands next we having the command which is a very common one that is who am I which will give us the provides information about the user and now we shall go for
6:45
actual practice on this H-base and here we'll be creating one table the name of
6:51
the table will be student and it has got two column families there is a pastoral
6:56
data and college data so right now we are going for table creation and data
7:01
in session in this session we'll be covering this part so to create a table named
7:07
a student which will be having two column families one is a personal data and another
7:12
one is the college data so how to create that one in that case the command
7:16
will be create then student remember the student must be enclosed within
7:20
single quotes comma so there is about a table name so now we are having the column
7:26
families the first column family will be personal data And next column family will be our college data
7:39
So create student that is a table name. Then we're having the personal data that is nothing but first column family and comma
7:47
the second column family is our college data. So now if I go for enter the command will be executed
7:56
The command has got executed. Now to see that the list of tables which are
8:01
they are existing to get that one we'll be issuing the common list and here you can find that
8:08
emp was pre-existing table and this is the table which we created that is the student is existing
8:13
when you issued the common list here okay now so this much we have done how to create a table
8:20
and how to get the list to see that what are the tables are existing in our system so now we are
8:27
going for describe and which will show the student table description so describe student remember student must be enclosed within single
8:37
quotes so now that is our that is our student it is telling and now we know that
8:42
we're having two column families one is the college data and another one is the
8:47
personal data you see so this is a column family's description name implies
8:53
college data and here you see the name implies personal data so this is one
8:58
set of information for the first column family and this is another set of information for the second column family and you can find that it is
9:06
having the key key value pair type of concept okay so we have done with this
9:13
described student now we shall go for some record insert so insert
9:19
details into the table for three different students so that we shall do the
9:24
command will be put and then student within single code obviously and then we
9:31
shall go for this one and then you shall go for personal data there is a first column
9:38
family under which I'm defining name and giving the name as say
9:45
ovishak so this is the name I've given here obishek okay so that is the first
9:51
one we given for there is our city there is a student put student one personal data colon city and here we giving this name as luckno
10:13
next we're going for college data here we're going for this college data here we're going for this
10:21
college data and here you can give this one as stream so this is a computer science
10:37
we're getting this one so here for here we're going for this year so there is
10:49
the year we shall go for second now we shall go for our second one second record so I shall go for this put
11:06
and then I shall make this one say I'm going for this one as personal data
11:11
name yes that will be better so I'm making this one as two then personal data name
11:21
Next one I shall go for city. Again this one I shall go for stream
11:46
Next one I shall go for stream. Making this one two here and then I shall go for this year
12:09
Okay, let us go for the another one. for the third student then I shall go for city then I shall go for stream
12:27
for the third student there is a stream electronics and last one say
12:34
year I'm going for the year and for the third student okay so I'm
12:43
I've done the entry of this information onto our student table. So in this particular demonstration, we have shown you that how to insert information
12:57
onto our table, how to issue the command describe, and how to create one table, what is
13:04
the purpose of list to get the list of all existing tables and so on
13:09
And in the next videos, we'll be going for more operations on this agenda
13:13
Thanks for watching this video
#Computer Education
#Computer Science
#Data Management
#Programming