mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
merge.test:
merge.test - it was missed in the previous commit :( manual.texi: fixed bad auto-merge of OLAP manual Docs/Makefile.am: removed ../MIRROR target (mirror list is no longer in the manual) Docs/Makefile.am: removed ../MIRROR target (mirror list is no longer in the manual) Docs/manual.texi: fixed bad auto-merge of OLAP manual mysql-test/t/merge.test: merge.test - it was missed in the previous commit :(
This commit is contained in:
parent
caa45d7b85
commit
815f1c4112
3 changed files with 163 additions and 150 deletions
|
@ -27,7 +27,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
|
|||
all: $(targets) txt_files
|
||||
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
|
||||
../MIRRORS INSTALL-BINARY
|
||||
INSTALL-BINARY # ../MIRRORS
|
||||
|
||||
CLEAN_FILES: $(BUILD_SOURCES)
|
||||
touch $(BUILD_SOURCES)
|
||||
|
@ -254,8 +254,8 @@ INSTALL-BINARY: mysql.info $(GT)
|
|||
../COPYING.LIB: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@
|
||||
|
||||
../MIRRORS: manual.texi $(srcdir)/Support/generate-mirror-listing.pl
|
||||
perl -w $(srcdir)/Support/generate-mirror-listing.pl manual.texi > $@
|
||||
#../MIRRORS: manual.texi $(srcdir)/Support/generate-mirror-listing.pl
|
||||
# perl -w $(srcdir)/Support/generate-mirror-listing.pl manual.texi > $@
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
|
286
Docs/manual.texi
286
Docs/manual.texi
|
@ -33551,7 +33551,8 @@ SELECT [STRAIGHT_JOIN]
|
|||
[INTO @{OUTFILE | DUMPFILE@} 'file_name' export_options]
|
||||
[FROM table_references
|
||||
[WHERE where_definition]
|
||||
[GROUP BY @{unsigned_integer | col_name | formula@} [ASC | DESC], ...]
|
||||
[GROUP BY @{unsigned_integer | col_name | formula@} [ASC | DESC], ...
|
||||
[WITH @{CUBE | ROLLUP@}] ]
|
||||
[HAVING where_definition]
|
||||
[ORDER BY @{unsigned_integer | col_name | formula@} [ASC | DESC] ,...]
|
||||
[LIMIT [offset,] rows]
|
||||
|
@ -33760,6 +33761,10 @@ If you are not getting the results you expect from your query, please
|
|||
read the @code{GROUP BY} description.
|
||||
@xref{Group by functions}.
|
||||
|
||||
@item
|
||||
Since Version 3.23.12 MySQL supports @code{CUBE} and @code{ROLLUP}
|
||||
clauses. @xref{CUBE and ROLLUP}.
|
||||
|
||||
@item
|
||||
@cindex hints
|
||||
@code{STRAIGHT_JOIN} forces the optimiser to join the tables in the order in
|
||||
|
@ -33869,6 +33874,7 @@ the examined rows will be write locked.
|
|||
@menu
|
||||
* JOIN:: @code{JOIN} Syntax
|
||||
* UNION:: @code{UNION} Syntax
|
||||
* CUBE and ROLLUP @code{CUBE} and @code{ROLLUP} Syntax
|
||||
@end menu
|
||||
|
||||
@node JOIN, UNION, SELECT, SELECT
|
||||
|
@ -34033,7 +34039,7 @@ mysql> SELECT * FROM table1 IGNORE INDEX (key3)
|
|||
@xref{LEFT JOIN optimisation, , @code{LEFT JOIN} optimisation}.
|
||||
|
||||
|
||||
@node UNION, , JOIN, SELECT
|
||||
@node UNION, CUBE and ROLLUP, JOIN, SELECT
|
||||
@subsubsection @code{UNION} Syntax
|
||||
|
||||
@findex UNION
|
||||
|
@ -34078,6 +34084,141 @@ UNION
|
|||
ORDER BY a;
|
||||
@end example
|
||||
|
||||
@node CUBE and ROLLUP, , UNION, SELECT
|
||||
@subsubsection @code{CUBE} and @code{ROLLUP} Syntax
|
||||
|
||||
Documentation for OLAP extension
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
MySQL will first support CUBE and ROLLUP operators from entire OLAP
|
||||
functionality.
|
||||
|
||||
The CUBE and ROLLUP extensions to SQL make querying and reporting
|
||||
easier in data warehousing environments. ROLLUP creates subtotals at
|
||||
increasing levels of aggregation, from the most detailed up to a grand
|
||||
total. CUBE is an extension similar to ROLLUP, enabling a single
|
||||
statement to calculate all possible combinations of subtotals.
|
||||
|
||||
|
||||
Syntax:
|
||||
------
|
||||
|
||||
The syntax supported by the enhanced mysql for CUBE and ROLLUP
|
||||
operators.
|
||||
|
||||
CUBE
|
||||
----
|
||||
|
||||
SELECT field1, field2, ... AGGR(fieldn) FROM
|
||||
table GROUP BY field1, field2 field(n-1) WITH CUBE
|
||||
|
||||
This would generate the aggregates with group bys of all the
|
||||
combinations of dimensions.
|
||||
|
||||
ROLLUP:
|
||||
-----
|
||||
|
||||
SELECT field1, field2, ... AGGR(fieldn) FROM table
|
||||
GROUP BY field1, field2 field(n-1) WITH ROLLUP
|
||||
|
||||
Example:
|
||||
-------
|
||||
|
||||
mysql> select * from sales;
|
||||
+------------+---------------+------+--------+
|
||||
| product | country | year | profit |
|
||||
+------------+---------------+------+--------+
|
||||
| Computer | India | 2000 | 1200 |
|
||||
| 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 |
|
||||
+------------+---------------+------+--------+
|
||||
14 rows in set (0.00 sec)
|
||||
|
||||
|
||||
|
||||
mysql> Select sales.product, sales.country , sales.year, sum(profit) from
|
||||
sales group by product, country, year with cube;
|
||||
|
||||
+------------+---------------+------+-------------+
|
||||
| product | country | year | sum(profit) |
|
||||
+------------+---------------+------+-------------+
|
||||
| Calculator | India | 2000 | 75 |
|
||||
| Calculator | United States | 1999 | 50 |
|
||||
| Calculator | United States | 2000 | 150 |
|
||||
| Computer | India | 1999 | 1200 |
|
||||
| Computer | India | 2000 | 1200 |
|
||||
| Computer | United States | 1999 | 1500 |
|
||||
| Computer | United States | 2000 | 3000 |
|
||||
| TV | India | 1999 | 100 |
|
||||
| TV | India | 2000 | 200 |
|
||||
| TV | United States | 1999 | 150 |
|
||||
| TV | United States | 2000 | 150 |
|
||||
| ALL | India | 1999 | 1300 |
|
||||
| ALL | India | 2000 | 1475 |
|
||||
| ALL | United States | 1999 | 1700 |
|
||||
| ALL | United States | 2000 | 3300 |
|
||||
| Calculator | ALL | 1999 | 50 |
|
||||
| Calculator | ALL | 2000 | 225 |
|
||||
| Computer | ALL | 1999 | 2700 |
|
||||
| Computer | ALL | 2000 | 4200 |
|
||||
| TV | ALL | 1999 | 250 |
|
||||
| TV | ALL | 2000 | 350 |
|
||||
| Calculator | India | 0 | 75 |
|
||||
| Calculator | United States | 0 | 200 |
|
||||
| Computer | India | 0 | 2400 |
|
||||
| Computer | United States | 0 | 4500 |
|
||||
| TV | India | 0 | 300 |
|
||||
| TV | United States | 0 | 300 |
|
||||
| ALL | ALL | 1999 | 3000 |
|
||||
| ALL | ALL | 2000 | 4775 |
|
||||
| ALL | India | 0 | 2775 |
|
||||
| ALL | United States | 0 | 5000 |
|
||||
| Calculator | ALL | 0 | 275 |
|
||||
| Computer | ALL | 0 | 6900 |
|
||||
| TV | ALL | 0 | 600 |
|
||||
| ALL | ALL | 0 | 7775 |
|
||||
+------------+---------------+------+-------------+
|
||||
35 rows in set (0.00 sec)
|
||||
|
||||
|
||||
MySQL supports now CUBE and ROLLUP extensions, with all functions
|
||||
that one wishes to use with them.
|
||||
|
||||
Those extensions already work in all tested combinations. They work
|
||||
with UNION's, should work with sub-selects in 4.1 and derived tables.
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
For the moment, ORDER and LIMIT are disabled for CUBE and ROLLUP. This
|
||||
however remains to be added later.
|
||||
|
||||
Another feature that has to be added later is grouping of select list
|
||||
itmes in order to alleviate user errors. For the moment, missing
|
||||
(hidden) columns are not used at all.
|
||||
|
||||
Third feature to be done is to make SQL SET OPTION to set values for
|
||||
all values of the column optionally to:
|
||||
|
||||
* ALL (as it is now)
|
||||
* NULL
|
||||
* blank
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
@findex HANDLER
|
||||
@node HANDLER, INSERT, SELECT, Data Manipulation
|
||||
@subsection @code{HANDLER} Syntax
|
||||
|
@ -49700,146 +49841,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
|||
Fixed a bug that made the pager option in the mysql client non-functional.
|
||||
@item
|
||||
Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables.
|
||||
@end itemize
|
||||
@item
|
||||
Added OLAP functionality.
|
||||
|
||||
@c Arjen , please add the following text somewhere appropriate in the
|
||||
text above:
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Documentation for OLAP extension
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
MySQL will first support CUBE and ROLLUP operators from entire OLAP
|
||||
functionality.
|
||||
|
||||
The CUBE and ROLLUP extensions to SQL make querying and reporting
|
||||
easier in data warehousing environments. ROLLUP creates subtotals at
|
||||
increasing levels of aggregation, from the most detailed up to a grand
|
||||
total. CUBE is an extension similar to ROLLUP, enabling a single
|
||||
statement to calculate all possible combinations of subtotals.
|
||||
|
||||
|
||||
Syntax:
|
||||
------
|
||||
|
||||
The syntax supported by the enhanced mysql for CUBE and ROLLUP
|
||||
operators.
|
||||
|
||||
CUBE
|
||||
----
|
||||
|
||||
SELECT field1, field2, ... AGGR(fieldn) FROM
|
||||
table GROUP BY field1, field2 field(n-1) WITH CUBE
|
||||
|
||||
This would generate the aggregates with group bys of all the
|
||||
combinations of dimensions.
|
||||
|
||||
ROLLUP:
|
||||
-----
|
||||
|
||||
SELECT field1, field2, ... AGGR(fieldn) FROM table
|
||||
GROUP BY field1, field2 field(n-1) WITH ROLLUP
|
||||
|
||||
Example:
|
||||
-------
|
||||
|
||||
mysql> select * from sales;
|
||||
+------------+---------------+------+--------+
|
||||
| product | country | year | profit |
|
||||
+------------+---------------+------+--------+
|
||||
| Computer | India | 2000 | 1200 |
|
||||
| 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 |
|
||||
+------------+---------------+------+--------+
|
||||
14 rows in set (0.00 sec)
|
||||
|
||||
|
||||
|
||||
mysql> Select sales.product, sales.country , sales.year, sum(profit) from
|
||||
sales group by product, country, year with cube;
|
||||
|
||||
+------------+---------------+------+-------------+
|
||||
| product | country | year | sum(profit) |
|
||||
+------------+---------------+------+-------------+
|
||||
| Calculator | India | 2000 | 75 |
|
||||
| Calculator | United States | 1999 | 50 |
|
||||
| Calculator | United States | 2000 | 150 |
|
||||
| Computer | India | 1999 | 1200 |
|
||||
| Computer | India | 2000 | 1200 |
|
||||
| Computer | United States | 1999 | 1500 |
|
||||
| Computer | United States | 2000 | 3000 |
|
||||
| TV | India | 1999 | 100 |
|
||||
| TV | India | 2000 | 200 |
|
||||
| TV | United States | 1999 | 150 |
|
||||
| TV | United States | 2000 | 150 |
|
||||
| ALL | India | 1999 | 1300 |
|
||||
| ALL | India | 2000 | 1475 |
|
||||
| ALL | United States | 1999 | 1700 |
|
||||
| ALL | United States | 2000 | 3300 |
|
||||
| Calculator | ALL | 1999 | 50 |
|
||||
| Calculator | ALL | 2000 | 225 |
|
||||
| Computer | ALL | 1999 | 2700 |
|
||||
| Computer | ALL | 2000 | 4200 |
|
||||
| TV | ALL | 1999 | 250 |
|
||||
| TV | ALL | 2000 | 350 |
|
||||
| Calculator | India | 0 | 75 |
|
||||
| Calculator | United States | 0 | 200 |
|
||||
| Computer | India | 0 | 2400 |
|
||||
| Computer | United States | 0 | 4500 |
|
||||
| TV | India | 0 | 300 |
|
||||
| TV | United States | 0 | 300 |
|
||||
| ALL | ALL | 1999 | 3000 |
|
||||
| ALL | ALL | 2000 | 4775 |
|
||||
| ALL | India | 0 | 2775 |
|
||||
| ALL | United States | 0 | 5000 |
|
||||
| Calculator | ALL | 0 | 275 |
|
||||
| Computer | ALL | 0 | 6900 |
|
||||
| TV | ALL | 0 | 600 |
|
||||
| ALL | ALL | 0 | 7775 |
|
||||
+------------+---------------+------+-------------+
|
||||
35 rows in set (0.00 sec)
|
||||
|
||||
|
||||
MySQL supports now CUBE and ROLLUP extensions, with all functions
|
||||
that one wishes to use with them.
|
||||
|
||||
Those extensions already work in all tested combinations. They work
|
||||
with UNION's, should work with sub-selects in 4.1 and derived tables.
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
For the moment, ORDER and LIMIT are disabled for CUBE and ROLLUP. This
|
||||
however remains to be added later.
|
||||
|
||||
Another feature that has to be added later is grouping of select list
|
||||
itmes in order to alleviate user errors. For the moment, missing
|
||||
(hidden) columns are not used at all.
|
||||
|
||||
Third feature to be done is to make SQL SET OPTION to set values for
|
||||
all values of the column optionally to:
|
||||
|
||||
* ALL (as it is now)
|
||||
* NULL
|
||||
* blank
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Added support for @code{CUBE} and @code{ROLLUP}.
|
||||
@end itemize
|
||||
|
||||
@node News-4.0.2, News-4.0.1, News-4.0.3, News-4.0.x
|
||||
@appendixsubsec Changes in release 4.0.2 (01 July 2002)
|
||||
|
|
|
@ -129,18 +129,18 @@ drop table t3,t1,t2;
|
|||
|
||||
drop table if exists t6, t5, t4, t3, t2, t1;
|
||||
# first testing of common stuff with new parameters
|
||||
create table t1 (a int not null, b int not null, key(a,b));
|
||||
create table t2 (a int not null, b int not null, key(a,b));
|
||||
create table t1 (a int not null, b int not null auto_increment, primary key(a,b));
|
||||
create table t2 (a int not null, b int not null auto_increment, primary key(a,b));
|
||||
create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO;
|
||||
create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
|
||||
create table t5 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
|
||||
create table t6 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
|
||||
create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
show create table t3;
|
||||
show create table t4;
|
||||
show create table t5;
|
||||
show create table t6;
|
||||
insert into t1 values (1,1),(1,2),(1,3),(1,4);
|
||||
insert into t2 values (2,1),(2,2),(2,3),(2,4);
|
||||
insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
|
||||
insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
|
||||
select * from t3 order by b,a limit 3;
|
||||
select * from t4 order by b,a limit 3;
|
||||
select * from t5 order by b,a limit 3,3;
|
||||
|
@ -167,7 +167,16 @@ select * from t2 order by a,b;
|
|||
select * from t3 order by a,b;
|
||||
select * from t4 order by a,b;
|
||||
select * from t5 order by a,b;
|
||||
# auto_increment
|
||||
select 1;
|
||||
insert into t5 values (1,NULL),(5,NULL);
|
||||
insert into t6 values (2,NULL),(6,NULL);
|
||||
select * from t1 order by a,b;
|
||||
select * from t2 order by a,b;
|
||||
select * from t5 order by a,b;
|
||||
select * from t6 order by a,b;
|
||||
drop table if exists t6, t5, t4, t3, t2, t1;
|
||||
|
||||
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,1);
|
||||
CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
|
||||
|
|
Loading…
Reference in a new issue