[SQL]DUALテーブル


ダブルテーブルはOracle標準テーブルで、1行に1色しかないDummyテーブルです.
1回の算術演算または仮想柱等値のみを取得する場合は、2つのテーブルを使用します.

SELECT COUNT(*), COUNT(NUM), SUM(NUM), AVG(NUM), MAX(NUM), MIN(NUM)

FROM 
  (
  SELECT NULL AS NUM FROM DUAL
  UNION ALL 
  SELECT 10 AS NUM FROM DUAL
  UNION ALL 
  SELECT 20 AS NUM FROM DUAL
  UNION ALL 
  SELECT 30 AS NUM FROM DUAL
  UNION ALL 
  SELECT 40 AS NUM FROM DUAL
  );