Question: drop table sample_db; create table sample_db ( order_category number not null, customer_number number not null, product_number number not null, product_type number not null, sales_value number(10,2)
drop table sample_db; create table sample_db ( order_category number not null, customer_number number not null, product_number number not null, product_type number not null, sales_value number(10,2) not null, month number not null, year number not null); insert into sample_db select trunc(dbms_random.value(1, 10)) as order_category, trunc(dbms_random.value(1000, 1100)) as customer_number, trunc(dbms_random.value(10000, 20000)) as product_number, trunc(dbms_random.value(1, 50)) as product_type, trunc(dbms_random.value(10, 1000), 2) as sales_value, trunc(dbms_random.value(1, 12)) as month, trunc(dbms_random.value(2000, 2010)) as year from dual connect by level <= 1000; commit;
Questions:
1. Write three separate SQL queries that use any three set operators.
2. Write an SQL query that uses the GROUP BY statement and one aggregate function.
3. Modify your previous query by adding the WHERE and HAVING statements.
4. Write an SQL query that includes the ROLLUP statement.
5. Write an SQL query that includes the CUBE statement.
6. Write an SQL query that includes the GROUPING SETS statement.
7. Write an SQL query that includes window functions.
8. Write three SQL queries that include several different analytical SQL functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
