text: -- Q4 (tpch2.6.1)
  
  --
  -- rewritten query before subquery support
  --
  --SELECT O_ORDERPRIORITY, COUNT(*) AS ORDER_COUNT
  --FROM ORDERS,
  --     (SELECT L_ORDERKEY
  --      FROM LINEITEM
  --      WHERE L_COMMITDATE < L_RECEIPTDATE
  --      GROUP BY L_ORDERKEY) AS TEMP
  --WHERE
  --    O_ORDERDATE >= DATE'1993-07-01' AND
  --    O_ORDERDATE < DATE'1993-10-01' AND
  --    O_ORDERKEY = TEMP.L_ORDERKEY
  --GROUP BY
  --    O_ORDERPRIORITY
  --ORDER BY
  --    O_ORDERPRIORITY;
  
  SELECT
      O_ORDERPRIORITY,
      COUNT(*) AS ORDER_COUNT
  FROM TPCH.ORDERS
  WHERE
      O_ORDERDATE >= DATE '1993-07-01'
      AND O_ORDERDATE < DATE '1993-10-01'
      AND EXISTS (
          SELECT
              *
          FROM
              TPCH.LINEITEM
          WHERE
              L_ORDERKEY = O_ORDERKEY
              AND L_COMMITDATE < L_RECEIPTDATE
      )
  GROUP BY
      O_ORDERPRIORITY
  ORDER BY
      O_ORDERPRIORITY;
  