Design a site like this with WordPress.com
Get started

Oracle Examples 2

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;*/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: