@@ -32929,7 +32928,7 @@ column value even if it isn't unique. The following gives the value of
...
@@ -32929,7 +32928,7 @@ column value even if it isn't unique. The following gives the value of
column:
column:
@example
@example
substr(MIN(concat(rpad(sort,6,' '),column)),7)
SUBSTR(MIN(CONCAT(RPAD(sort,6,' '),column)),7)
@end example
@end example
@xref{example-Maximum-column-group-row}.
@xref{example-Maximum-column-group-row}.
...
@@ -33119,7 +33118,7 @@ In MySQL Version 3.22.5 or later, you can also write queries like this:
...
@@ -33119,7 +33118,7 @@ In MySQL Version 3.22.5 or later, you can also write queries like this:
@example
@example
mysql> SELECT user,MAX(salary) FROM users
mysql> SELECT user,MAX(salary) FROM users
-> group by user HAVING max(salary)>10;
-> GROUP BY user HAVING MAX(salary)>10;
@end example
@end example
In older MySQL versions, you can write this instead:
In older MySQL versions, you can write this instead:
...
@@ -34355,10 +34354,10 @@ For example, to read a file of jokes, that are separated with a line
...
@@ -34355,10 +34354,10 @@ For example, to read a file of jokes, that are separated with a line
of @code{%%}, into a SQL table you can do:
of @code{%%}, into a SQL table you can do:
@example
@example
create table jokes (a int not null auto_increment primary key, joke text
CREATE TABLE jokes (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, joke TEXT
not null);
NOT NULL);
load data infile "/tmp/jokes.txt" into table jokes fields terminated by ""
LOAD DATA INFILE "/tmp/jokes.txt" INTO TABLE jokes FIELDS TERMINATED BY ""
lines terminated by "\n%%\n" (joke);
LINES TERMINATED BY "\n%%\n" (joke);
@end example
@end example
@code{FIELDS [OPTIONALLY] ENCLOSED BY} controls quoting of fields. For
@code{FIELDS [OPTIONALLY] ENCLOSED BY} controls quoting of fields. For
...
@@ -34852,11 +34851,11 @@ with @code{DELETE FROM table_name} (without a @code{WHERE}) in
...
@@ -34852,11 +34851,11 @@ with @code{DELETE FROM table_name} (without a @code{WHERE}) in
@strong{NOTE:} There can be only one @code{AUTO_INCREMENT} column per
@strong{NOTE:} There can be only one @code{AUTO_INCREMENT} column per
table, and it must be indexed. MySQL Version 3.23 will also only
table, and it must be indexed. MySQL Version 3.23 will also only
work properly if the auto_increment column only has positive
work properly if the @code{AUTO_INCREMENT} column only has positive
values. Inserting a negative number is regarded as inserting a very large
values. Inserting a negative number is regarded as inserting a very large
positive number. This is done to avoid precision problems when
positive number. This is done to avoid precision problems when
numbers 'wrap' over from positive to negative and also to ensure that one
numbers 'wrap' over from positive to negative and also to ensure that one
doesn't accidentally get an auto_increment column that contains 0.
doesn't accidentally get an @code{AUTO_INCREMENT} column that contains 0.
In MyISAM and BDB tables you can specify @code{AUTO_INCREMENT} secondary
In MyISAM and BDB tables you can specify @code{AUTO_INCREMENT} secondary
column in a multi-column key. @xref{example-AUTO_INCREMENT}.
column in a multi-column key. @xref{example-AUTO_INCREMENT}.
...
@@ -34980,7 +34979,7 @@ Only the @code{MyISAM} table type supports indexing on @code{BLOB} and
...
@@ -34980,7 +34979,7 @@ Only the @code{MyISAM} table type supports indexing on @code{BLOB} and
@code{TEXT} columns. When putting an index on a @code{BLOB} or @code{TEXT}
@code{TEXT} columns. When putting an index on a @code{BLOB} or @code{TEXT}
column you MUST always specify the length of the index:
column you MUST always specify the length of the index:
@example
@example
CREATE TABLE test (blob_col BLOB, index(blob_col(10)));
CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)));
@end example
@end example
@item
@item
...
@@ -35046,7 +35045,7 @@ The options work for all table types, if not otherwise indicated:
...
@@ -35046,7 +35045,7 @@ The options work for all table types, if not otherwise indicated:
@multitable @columnfractions .25 .75
@multitable @columnfractions .25 .75
@item @strong{Option} @tab @strong{Description}
@item @strong{Option} @tab @strong{Description}
@item @code{AUTO_INCREMENT} @tab The next auto_increment value you want to set for your table (MyISAM).
@item @code{AUTO_INCREMENT} @tab The next @code{AUTO_INCREMENT} value you want to set for your table (MyISAM).
@item @code{AVG_ROW_LENGTH} @tab An approximation of the average row length for your table. You only need to set this for large tables with variable size records.
@item @code{AVG_ROW_LENGTH} @tab An approximation of the average row length for your table. You only need to set this for large tables with variable size records.
@item @code{CHECKSUM} @tab Set this to 1 if you want MySQL to maintain a checksum for all rows (makes the table a little slower to update but makes it easier to find corrupted tables) (MyISAM).
@item @code{CHECKSUM} @tab Set this to 1 if you want MySQL to maintain a checksum for all rows (makes the table a little slower to update but makes it easier to find corrupted tables) (MyISAM).
@item @code{COMMENT} @tab A 60-character comment for your table.
@item @code{COMMENT} @tab A 60-character comment for your table.
...
@@ -35689,9 +35688,9 @@ is issued:
...
@@ -35689,9 +35688,9 @@ is issued:
@example
@example
mysql> USE db1;
mysql> USE db1;
mysql> SELECT count(*) FROM mytable; # selects from db1.mytable
mysql> SELECT COUNT(*) FROM mytable; # selects from db1.mytable
mysql> USE db2;
mysql> USE db2;
mysql> SELECT count(*) FROM mytable; # selects from db2.mytable
mysql> SELECT COUNT(*) FROM mytable; # selects from db2.mytable
@end example
@end example
Making a particular database current by means of the @code{USE} statement
Making a particular database current by means of the @code{USE} statement
...
@@ -37233,7 +37232,6 @@ INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
...
@@ -37233,7 +37232,6 @@ INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
CREATE TABLE total (a INT NOT NULL, message CHAR(20), KEY(a))
CREATE TABLE total (a INT NOT NULL, message CHAR(20), KEY(a))
TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
@end example
@end example
@c CAPPING DONE TO HERE
Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the
Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the
@code{total} table as the key isn't going to be unique in the @code{total}
@code{total} table as the key isn't going to be unique in the @code{total}