SQL GROUP BY örnekleri

Materilized ViewCREATE MATERIALIZED VIEW sales_mv ASSELECTchannel_desc channel,prod_category category,prod_subcategory subcategory,prod_name product,calendar_year year,calendar_quarter_number quarter,calendar_month_number month,SUM(amount_sold) salesFROM sales, times, products, channelsWHERE sales.time_id = times.time_idAND sales.prod_id = products.prod_idAND sales.channel_id = channels.channel_idAND prod_category IN ('Photo', 'Hardware')AND calendar_year IN (2000, 2001)AND channel_desc IN ('Direct Sales', 'Internet')GROUP BY channel_desc, prod_category, prod_subcategory, prod_name, calendar_year,calendar_quarter_number, calendar_month_number;ROLLUP EXTENSIONSQL> select year, quarter, month, sum(sales) sales2 from … Continue reading SQL GROUP BY örnekleri