I have three table BX-Books.csv ISBN, Book-Title, Book-Author, Year-Of-Publication, Publisher BX-Book-Ratings.csv User-ID ISBN Book-Rating BX-Users.csv User-ID Location Age I have to find most …
Tag: hiveql
Order of the tables in a JOIN
In spark-sql I have a query that uses several tables (both large & small) in Joins. My question is – does the order of these tables matter with respect to query performance ? For e.g. select …
Two different table counts insert into Hive Table
i need to insert data into hive table from two different table counts. example, let assume i have a table sample having fields counter1 and counter2 now i have another two tables test1 and test2. i …
Split column in hive
I am new to Hive and Hadoop framework. I am trying to write a hive query to split the column delimited by a pipe ‘|’ character. Then I want to group up the 2 adjacent values and separate them into …
Hive: Cant perform union query with limit
I am trying to run a union all query in hive but i get I also tried but i got what am i doing wrong ? Answer Use select from subquery:
SQL Query to Select Min and Max Values For Each Day Over a Period
I would like to select all the rows that contain either min or max datetime values for each equipment_id, for every day included in the period. The code below selects the min and max datetime values …
Divide each value of a column by the total count of records in a table
A query that is capable of dividing each value of a column by the total number of records in the table I tried the following query I see an error and not able to execute the query. for example total records is 5 so (1/5)*100 = 20 Answer use analytic count(*) over():
Hive Query : To calculate max indicator value based on priority and date
I tried to frame the query but somehow not getting the required result hence posting. I am new to hive. Apologies if it is very simple. Source Data : Ik – priority – ind1 – ind2 – date 1 – A – …
Hive: less than operator error in subquery
I want the latest records from HIVE table using the following query- WITH lot as (select * from to_burn_in as a where a.rel_lot=’${Rel_Lot}’) select a.* from lot AS a where not exists (select 1 from …
In SQL How to convert time into UNIX timestamp
In hive there is some data I have. Now I want to convert the start_timestamp into unix_timestamp in second. How to do that? Because the start_timestamp has two formats: First format: 2018-03-22 …