Hello;
Here we have more Oracle information and examples:
/*SELECT product_id, product_type_id,
CASE product_type_id
WHEN 1 THEN ‘Book’
WHEN 2 THEN ‘Video’
WHEN 3 THEN ‘DVD’
WHEN 4 THEN ‘CD’
ELSE ‘Magazine’
END
FROM products;*/
/*SELECT product_id, product_type_id,
CASE
WHEN product_type_id = 1 THEN ‘Book’
WHEN product_type_id = 2 THEN ‘Video’
WHEN product_type_id = 3 THEN ‘DVD’
WHEN product_type_id = 4 THEN ‘CD’
ELSE ‘Magazine’
END
FROM products;*/
/*SELECT product_id, price,
CASE
WHEN price > 15 THEN ‘Expensive’
ELSE ‘Cheap’
END
FROM products;*/
–select * from division;
/*SELECT division_id, SUM(salary)
FROM employees2
GROUP BY ROLLUP(division_id,JOB_ID)
ORDER BY division_id,job_id;*/
/*SELECT division_id,job_id, SUM(salary)
FROM employees2
GROUP BY ROLLUP(division_id,JOB_ID)
ORDER BY division_id,job_id;*/
/*SELECT division_id, job_id, SUM(salary)
FROM employees2
GROUP BY CUBE(division_id, job_id)
ORDER BY division_id, job_id;*/
/*SELECT
CASE GROUPING(division_id)
WHEN 1 THEN ‘All divisions’
ELSE division_id
END AS div,
CASE GROUPING(job_id)
WHEN 1 THEN ‘All jobs’
ELSE job_id
END AS job,
SUM(salary)
FROM employees2
GROUP BY ROLLUP(division_id,job_id)
ORDER BY division_id;*/
/*SELECT
CASE GROUPING(division_id)
WHEN 1 THEN ‘All divisions’
ELSE division_id
END AS div,
CASE GROUPING(job_id)
WHEN 1 THEN ‘All jobs’
ELSE job_id
END AS job,
SUM(salary)
FROM employees2
GROUP BY CUBE(division_id, job_id)
ORDER BY division_id, job_id;*/
/*SELECT *
FROM (
SELECT month, prd_type_id, amount
FROM all_sales
WHERE year = 2003
AND prd_type_id IN (1, 2, 3)
)
PIVOT (
SUM(amount) FOR month IN (1 AS JAN, 2 AS FEB, 3 AS MAR, 4 AS APR)
)
ORDER BY prd_type_id;*/