Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- country_region,country_name,
- round(sum(quantity_sold*amount_sold)) as total
- from
- sales join customers
- on sales.cust_id=customers.cust_id
- join countries
- on customers.country_id=countries.country_id
- group by country_region,country_name
- order by country_region,country_name;
- select
- cust_last_name,extract(year from time_id)as yyear,
- to_char(time_id,'q') as quarter,
- round(sum(quantity_sold*amount_sold)) as total
- from sales
- join customers
- on sales.cust_id=customers.cust_id
- group by
- cust_last_name,extract(year from time_id),to_char(time_id,'q')
- order by cust_last_name, yyear,quarter;
- select
- prod_name,extract(year from time_id)as yyear,
- to_char(time_id,'q') as quarter,
- round(sum(quantity_sold*amount_sold)) as total
- from sales
- join products
- on sales.prod_id=products.prod_id
- group by
- prod_name,extract(year from time_id),to_char(time_id,'q')
- order by prod_name, yyear,quarter;
- select
- prod_category,prod_subcategory,
- round(sum(quantity_sold*amount_sold)) as total
- from sales
- join products
- on sales.prod_id=products.prod_id
- group by
- prod_category,prod_subcategory
- order by prod_category,prod_subcategory;
- select
- prod_category,prod_subcategory,
- extract(year from time_id)as yyear,
- to_char(time_id,'q') as quarter,
- round(sum(quantity_sold*amount_sold)) as total
- from sales
- join products
- on sales.prod_id=products.prod_id
- group by
- prod_category,prod_subcategory,
- extract(year from time_id),to_char(time_id,'q')
- order by prod_category,prod_subcategory,yyear,quarter;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement