i want to insert a row to service_log table with max+1 id value. But this gives me the following error ; How can i solve this problem? Answer This should work with most SQL dialects:
Tag: cloudera
Extract year from timestamp in hive
I am writing the query to show the data entries for a specific year. Date is stored in dd/mm/yyyy hh:mm:ss.(Date TIMESTAMP – e.g. 12/2/2014 0:00:00). I am trying to display the two columns(name, orderdate) filtered by a specific year(year from orderdate). The requirement is to enter the specific year(2010 or 2020 etc) not the entire date. I tried using date_format()
hive get percentages of count column not working
i have the following query in hive to get the counts per each of those columns (cluster, country and airline) as a percentage. But my percentage column contains only 0’s.. why/what am i doing wrong below? Answer First, you should use window functions. Second, beware of integer division. I would phrase this as:
SQL (HUE) : Is there any way to convert 24 hrs time into 12 hrs AM / PM format with hours buckets
I have table A which contains column time stored as timestamp datatype. Table A: Contains time column in HH:MM:SS in 24 hrs format. Answer Please use below code. Replace now() with time for your query. Explanation – firstly i am checking if hour is >12. If yes, deducting 12 to get the hour. Then setting up AM/PM based on hour.
Impala: Split single row into multiple rows based on Date and time
I want to split a single row into multiple rows based on time. Expected output is below: Day start from 00:00 AM to next day 00:00 AM. When EndDate time is greater than 00:00 AM (midnight) then split this date in two rows. First row end date is 30/03/2020 11:59:00 and next row start 31/03/2020 00:00:00. Please help me to
Hive: How do I INSERT data FROM a PARTITIONED table INTO a PARTITIONED table?
This is an extension of a previous question I asked: Is it possible to change an existing column’s metadata on an EXTERNAL table that is defined by an AVRO schema file? Question: In Hive 2.1.1, how do I INSERT data FROM a PARTITIONED table INTO a PARTITIONED table? What is the correct syntax? I have seen material all over the
How to get Sum of many columns as one
am working to get percentage of GSM , DEPOT , IPMSAN ..Etc and I would like to sum the counts within each column that correspond to each WITH q2 AS ( SELECT c2.compteur, c1.police , ( SUM(c1….
Will the constraints remain after Importing table from RDBMS to HIVE with sqoop?
When we use sqoop import to transfer an RDBMS table to HIVE, will the constraints of the table such as primary key remain ? i.e. will the column of the table which is the primary key remain as …