Table Creation in Hive
22K views
Oct 24, 2024
Table Creation in Hive 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 table creation in Hybe
0:04
In the previous video we have shown you that how to create one database and how to use that one
0:11
So let us go for table creation in Hype. So how to create table in Hype
0:17
So create table is a statement used to create a table in Hype and the syntax and examples
0:23
will be as follows. So create table name, attribute types, then we will
0:29
going for row format then row format has to be mentioned then fields terminated by delimiter
0:37
so fields terminated by delimiter and then one semicolon so this is a this is a total
0:43
command to create one table with the respective table name and other details we can use some
0:49
other attributes related to the table also so to see the table description after creation
0:56
you can see the description of the table use the command described then
0:59
table name and then one semicolon after that So let us go for one practical demonstration to show you that how these tables can get created and how to use the describe command
1:11
In this demonstration, we shall create one table. The name of the table will be student
1:16
and this table will be created under the database, that is the My database which you created in the earlier video
1:23
So already we have used the command, that is the Use My database
1:27
So whenever I shall create this table, the name of the table will be stood and that will be under this my database only so how to
1:36
create a database how to create a table under this database my database and here the table name
1:42
will be stood and it will have three fields so first one is the name then the major and the last
1:48
one it will be the city and all of them will be of the type of string so I'm going to issue
1:53
the command so I shall go for this create then table I shall go for create table
1:59
the table name is stood and then i shall go for this name of the type of string say major of the type of string then we shall go for your city of the type of string bracket
2:17
closing then we shall go for row format delimited so row format delimited
2:27
fields terminated by comma so terminated by comma so comma should be kept within the single
2:43
quotes here and then we shall go for stored as text file so here you see the
2:51
command is our create table stood name of the type of string measure of the
2:56
type of string city of the type of string so the first bracket will get
3:00
ended here row format delimited fields terminated by comma and here and here
3:06
here we having this one as stored as text file so the table has got created now so we can use we can see the table description using the command describe You can go for this described stude You can see that the table description will be obtained
3:26
You shall go for describe. So I think the previous comment was having some error
3:33
I shall go for this describe stood. You can find the description here
3:39
You can get the description. That is our name of the field is name
3:42
of the type of string. Next field is our major of the type of string and city of the type of string
3:49
So if you type this, describe stood, you see, we have written this describe in the capital
3:57
letters, then also the command will get executed. So here the command is case insensitive
4:02
You can write these commands either in the lowercase or in the uppercase letters and both
4:07
will behave the same. So in this way, in this particular demonstration we have shown you that how to create a
4:12
table, here the table name was stood and how to see the respective description of this
4:19
table using the command described. Thanks for watching this
#Data Management
#Programming