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; 
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Deepu298
  • 65
  • 2
  • 11

2 Answers2

0

Maybe you must write case sensitive like this:

CREATE TEMPORARY TABLE temp1(col1 STRING);
Mladen S
  • 93
  • 7
0

The same CTE as in MySQL:

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

select * from your_table;

Another example: https://stackoverflow.com/a/54960324/2700344

Hive CTE Official docs

leftjoin
  • 36,950
  • 8
  • 57
  • 116