SHARE
TWEET

Untitled

a guest Oct 3rd, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     p_name,
  3.     c_name,
  4.     item
  5. FROM (
  6.     SELECT
  7.         p_name,
  8.         c_name,
  9.         item,
  10.         column_value AS city
  11.     FROM
  12.         (
  13.             SELECT
  14.                 p_name,
  15.                 c_name,
  16.                 item,
  17.                 cities
  18.             FROM (
  19.                 SELECT
  20.                     p_name,
  21.                     item,
  22.                     CAST(COLLECT(city) AS CITIES_ARRAY) AS cities
  23.                 FROM (
  24.                     SELECT
  25.                     p_name,
  26.                     item,
  27.                     column_value AS city
  28.                     FROM
  29.                     producers p,
  30.                     TABLE(p.cities) ct
  31.                 )
  32.                 WHERE
  33.                     city < 500
  34.                 GROUP BY p_name, item
  35.             )
  36.             NATURAL JOIN customers c
  37.         ) p,
  38.         TABLE(p.cities)
  39. )
  40. NATURAL JOIN cities ct
  41. WHERE ct.country = 'Russia'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top