Sunday 7 August 2022

HIVE: WHERE filter in SELECT query

WHERE clause used to filter and fetch the records that satisfy given condition.

 

Syntax

select * from table_name where condition;

 

hive> select * from employee;
OK
1   Hari    ["Football","Cricket"]  {"Java":"3.4Yrs","C":"4.5Yrs"}  {"gender":"Male","age":30}
2   Chamu   ["Trekking","Watching movies"]  {"Selenium":"5.6Yrs"}   {"gender":"Feale","age":38}
3   Sailu   ["Chess","Listening to music"]  {"EmbeddedC":"9Yrs"}    {"gender":"Femle","age":32}
4   Gopi    ["Cricket"] {"Datastage":"11Yrs"}   {"gender":"Male","age":32}
Time taken: 0.072 seconds, Fetched: 4 row(s)

 

a. Select all the employees whose name is Gopi.

hive> select * from employee where name='Gopi';
OK
4   Gopi    ["Cricket"] {"Datastage":"11Yrs"}   {"gender":"Male","age":32}
Time taken: 0.087 seconds, Fetched: 1 row(s)

 

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment