2003-01-06 00:48:59 +01:00
drop table if exists t1;
create table t1 ( product varchar(32), country varchar(32), year int, profit int);
insert into t1 values ( 'Computer', 'India',2000, 1200),
2002-07-20 13:51:52 +02:00
( 'TV', 'United States', 1999, 150),
( 'Calculator', 'United States', 1999,50),
( 'Computer', 'United States', 1999,1500),
( 'Computer', 'United States', 2000,1500),
( 'TV', 'United States', 2000, 150),
( 'TV', 'India', 2000, 100),
( 'TV', 'India', 2000, 100),
( 'Calculator', 'United States', 2000,75),
( 'Calculator', 'India', 2000,75),
( 'TV', 'India', 1999, 100),
( 'Computer', 'India', 1999,1200),
( 'Computer', 'United States', 2000,1500),
( 'Calculator', 'United States', 2000,75);
2003-01-06 00:48:59 +01:00
select product, country , year, sum(profit) from t1 group by product, country, year with cube;
2002-08-08 19:49:06 +02:00
This version of MySQL doesn't yet support 'CUBE'
2003-01-06 00:48:59 +01:00
explain select product, country , year, sum(profit) from t1 group by product, country, year with cube;
2002-08-08 19:49:06 +02:00
This version of MySQL doesn't yet support 'CUBE'
2003-01-06 00:48:59 +01:00
select product, country , year, sum(profit) from t1 group by product, country, year with rollup;
2002-08-08 19:49:06 +02:00
This version of MySQL doesn't yet support 'ROLLUP'
2003-01-06 00:48:59 +01:00
explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup;
2002-08-08 19:49:06 +02:00
This version of MySQL doesn't yet support 'ROLLUP'
2003-01-06 00:48:59 +01:00
select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup;
2002-08-08 19:49:06 +02:00
This version of MySQL doesn't yet support 'CUBE'
2003-01-06 00:48:59 +01:00
drop table t1;