0

I use WITH table_name AS (select...;) command in SQL Developer to create temporary table and use that temp table in following queries. What is the similar command in Hadoop Hive?

Using SQL assistant User interface on Hadoop Hive.

I tried the following example, which gives error-

Create table Failed,80:

CREATE TEMPORARY TABLE temp1(col1 string);
CREATE TEMPORARY TABLE temp2 AS Select * from table_name; 
  • Which version of Hive are you using? – APC Apr 11 at 16:23
0

Maybe you must write case sensitive like this:

CREATE TEMPORARY TABLE temp1(col1 STRING);
0

The same CTE as in MySQL:

with your_table as (
select 'some value' --from etc etc
)

select * from your_table;

Another example: https://sid.justtry.fun/a/54960324/2700344

Hive CTE Official docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.