hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Trivial Update of "Hive/LanguageManual/SubQueries" by RaghothamMurthy
Date Wed, 21 Jan 2009 23:31:50 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by RaghothamMurthy:
http://wiki.apache.org/hadoop/Hive/LanguageManual/SubQueries

New page:
Syntax:
{{{
SELECT ... FROM (subquery) name ...
}}}
Hive supports subqueries only in the FROM clause. The subquery has to be given a name because
every table in a FROM clause must have a name. Columns in the subquery select list must have
unique names. The columns in the subquery select list are available in the outer query just
like columns of a table. The subquery can also be a query expression with UNION. Hive supports
arbitrary levels of sub-queries.

Example with simple subquery:
{{{
SELECT col 
FROM (
  SELECT a+b AS col
  FROM t1
) t2
}}}

Example with subquery containing a UNION ALL:
{{{
SELECT t3.col
FROM (
  SELECT a+b AS col
  FROM t1
  UNION ALL
  SELECT c+d AS col
  FROM t2
) t3
}}}

Mime
View raw message